I am trying to insert a image to a panel as follows but it does not work:
ImageIcon image = new ImageIcon("image.gif");
panel.add(image,BorderLayout.EAST);
p.s. the image is in the same location as the java file
What I am trying to do is display a JLabel and then after 5 seconds I wish to hide the label. I have the following code but it does not work:
label.setText("hi")
try {Thread.sleep(5000);} catch (InterruptedExecution e){}
label.setText(null)
I also tried repaint but didnt work...
Right in class1 i have a JTable. When the user selects a row i have done coding to return the value displayed in the selected row (column 0). Class1 coding is as follows:
class1
public static string s1;
class1Constructor(){
tableGUI
insertDataInTable
}
mousepressed(){
row =...
I have 3 classes: class1 extends Jpanel, class2 extends Jpanel, class3 extends JFrame. What I am trying to do is set the textfields in class1 from class2 according to user input: user enters an ID and presses a button (in another frame: class4) and data relating to that ID e.g. name, number...
I have 3 classes: class1, class2 and timeClass. class1 and class2 each have a textfield, and what I am trying to do is display the time (from time class) in both textfields of the different classes (NOTE the time class is working correctly). I can get the time to display in 1 class textfield but...
I have 2 classes: class1, class2. In class2 I have a textfield. In class1 I am trying to set the textfield in class2 with text: class2.textField_name.setText(string). This does not work - null pointer exception???
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.