473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

iconLabel add() to JFrame

11
Currently using the line

JLabel iconLabel =
new JLabel (new ImageIcon("aboutlogo.gif"));

then later...

d.add( iconLabel);

to add to the frame 'd'

i have the gif in the same folder as the source files atm just to make it work, but with no joy im looking to use the path 'File: .\icons\aboutlogo.gif' similar to the ones i have designed in the GUI of the IDE.

Can anyone help point me in the right direction as the logo does not appear, yet the normal text labels i've added do
Apr 4 '07 #1
2 1274
r035198x
13,262 8TB
Currently using the line

JLabel iconLabel =
new JLabel (new ImageIcon("aboutlogo.gif"));

then later...

d.add( iconLabel);

to add to the frame 'd'

i have the gif in the same folder as the source files atm just to make it work, but with no joy im looking to use the path 'File: .\icons\aboutlogo.gif' similar to the ones i have designed in the GUI of the IDE.

Can anyone help point me in the right direction as the logo does not appear, yet the normal text labels i've added do
Perhaps if you show us a bit of your code ...
Apr 5 '07 #2
davedwm
11
Perhaps if you show us a bit of your code ...
This is the full method

private void jMenuItemAboutActionPerformed(java.awt.event.Actio nEvent evt) {

Frame window = new Frame();

// Create a modal dialog
d = new Dialog(window, "About", true);

// Use a Grid layout
d.setLayout( new GridLayout(5, 1, 10, 10) );

//Create Image
JLabel iconLabel =
new JLabel (new ImageIcon("aboutlogo.gif"));

// Create an OK button
Button ok = new Button ("OK");
ok.addActionListener ( new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
// Hide dialog
d.setVisible(false);
}
});

d.add( iconLabel);
d.add( new JLabel (" HTML Editor for Beginners"));
d.add( ok );


// Show dialog
d.pack();
d.setVisible(true);

}
Apr 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: sreenulanka | last post by:
please help me in my forum i have labels and textareas .iwant to add textarea components dyanamically when i am clicking the button.please help me import java.awt.*; import javax.swing.*;...
2
by: vertozia | last post by:
Hey there, ive been having difficulty placing an image, this is my screenshot, and what ive done so far: http://img341.imageshack.us/img341/9894/gridwg2.jpg /** * ConnectFourGUI * Provide...
1
by: rpm27 | last post by:
I'm new to Java. I am starting to understand Java GUI dimension (the swing library), and I need someone to clarify something to me: As far as I know, JFrame objects provide a window (with the...
3
by: coffeetime | last post by:
Hi, I just decided to learn java, so I'm quite a noob. I use the book learning java third edition. have JDK 1.6 program in notepad. I have made the simple HelloJava example, and now i wanted to...
3
by: coffeetime | last post by:
Hi, I just decided to learn java, so I'm quite a noob. I use the book learning java third edition. have JDK 1.6 program in notepad. I have made the simple HelloJava example, and now i wanted to...
2
by: zahit | last post by:
hi guys, my line doesn't appear on the frame. what's the problem? import java.util.*; import java.io.*; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; public class...
3
by: notaCons | last post by:
hello im quite newbies in Java Programing so any one can help me. i will be plz.... what am i trying here is try convert The JFrame to JApplet, but when i change the JFrame to JApplet 4 Error come...
6
by: gaya3 | last post by:
Hi, I need to make the frame invisible on action event in swings. I have the following code: public class sample_pgm extends JFrame{ public void sample() { JFrame jf =...
9
by: jrobinson3k1 | last post by:
Whenever I run my GUI, the frame is pinned as the top window ALWAYS even though I never set it to be like that. I even added in setAlwaysOnTop(false) for good measure (it's default false, right?) and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.