I have a very strange problem with my java application. I basically click the JButton and the new window I want to open opens but with no content showing. Here is what happens.
If I run the class on its own without using a JButton it runs proberly like so.
Here is the code for the button.
public Create()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 629, 316);
contentPane = new JPanel();
contentPane.setBackground(new Color(255, 255, 204));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
btnBuildData = new JButton("Build Graph");
btnBuildData.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
//CreateTest frame = new CreateTest();
new CreateTest().setVisible(true);
}
});
btnBuildData.setBackground(Color.WHITE);
btnBuildData.setForeground(Color.BLACK);
btnBuildData.setBounds(29, 59, 107, 23);
contentPane.add(btnBuildData);
This is strange to me because I have used this code for other classes and it works as intended. I have tried many different ways to do the same thing but none of them have worked. Here is some code for the frame I am opening with the button.
public class CreateTest extends JFrame {
public CreateTest() {
}
//Create the connection to Neo4j
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "*****", "*******" ) );
Session session = driver.session();
StatementResult resultVariable;
Record recordVariable;
//Create variables to manage communication with Neo4j
String resultString = new String();
Query neoQuery = new Query();
private JTextField progressTextField;
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
{
#Override
public void run()
{
new CreateTest().initUI();
}
});
}
protected void initUI()
{
final JFrame frame = new JFrame();
//the form
frame.setTitle(CreateTest.class.getSimpleName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("Click here to add data");
button.addActionListener(new ActionListener()
{
#Override
public void actionPerformed(ActionEvent e)
{
doWork();
}
});
progressTextField = new JTextField(25);
progressTextField.setEditable(false);
frame.getContentPane().add(progressTextField, BorderLayout.NORTH);
frame.getContentPane().add(button, BorderLayout.SOUTH);
frame.pack();
frame.setVisible(true);
}
protected void doWork() {
SwingWorker<Void, Integer> worker = new SwingWorker<Void, Integer>() {
#Override
protected Void doInBackground() throws Exception {
CreateTest frame = new CreateTest();
}
#Override
protected void process(List<Integer> chunks) {
progressTextField.setText(chunks.get(chunks.size() - 1).toString());
}
#Override
protected void done() {
progressTextField.setText("Success: All Nodes have been added ");
}
};
worker.execute();
}
}
There is a difference between the two windows. One being absolute layout and the other jpanel but I don't think this is the problem. If anyone has any ideas please let me know, any ideas will be appreciated. Thanks.
Your calling an empty constructor with new CreateTest()
public CreateTest() {
}
It does nothing since your code is outside of it.
Related
i have the following code, where i try to make some jLabels/jComboBox visible/invisible and move the location of those that are visible on jRadioButton click.
the issue is that the location is updated only on second click.
private void SingleButtonActionPerformed(java.awt.event.ActionEvent evt) {
this.serverLabel.setVisible(true);
this.serverList.setVisible(true);
this.serverLabel.setLocation(this.hostGroupLabel.getLocation().x, this.cpuCountSpinner.getLocation().y);
this.serverList.setLocation(this.cpuCountSpinner.getLocation().x, this.cpuCountSpinner.getLocation().y);
this.jXDatePickerStartDate.setLocation(153, jXDatePickerStartDate.getLocation().y);
this.requestedRamLabel.setVisible(false);
this.ramText.setVisible(false);
this.cpuLabel.setVisible(false);
this.cpuCountSpinner.setVisible(false);
}
I dont know why it is not working for you, mayby you are modifying somewhere else your GUI, or event is not fired at all. Here is working example. You should pase the code where you actually append the listener to the button. You did that right? It should be something like:
button.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
singleButtonActionPerformed(e)
}
});
or Java8 variant using Lambdas
button.addActionListener(this::singleButtonActionPerformed)
but using this depends on context. It should be the object hta holds given method.
Here is working example with button and radio button (as suggested)
public class SettingLocation {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setSize(400, 400);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel p = new JPanel();
f.setContentPane(p);
p.setLayout(new FlowLayout());
JButton b = new JButton("Click me");
b.setBounds(150, 150,100,100);
p.add(b);
JRadioButton rb=new JRadioButton("Exmaple radio");
p.add(rb);
rb.addActionListener(new ActionListener() {
Random r = new Random();
#Override
public void actionPerformed(ActionEvent e) {
rb.setLocation(r.nextInt(300), r.nextInt(300));
}
});
b.addActionListener(new ActionListener() {
Random r = new Random();
#Override
public void actionPerformed(ActionEvent e) {
b.setLocation(r.nextInt(300), r.nextInt(300));
}
});
f.setVisible(true);
}
}
I am creating a program, and I have my main class that works with all the JButtons, but I can't get my second class that calls the first class launch with the buttons. The JFrame will launch, but the buttons won't.
I am using eclipse just for the information.
Here is the code of my main class:
public class Unescapable extends JPanel implements ActionListener
{
private static final long serialVersionUID = 1L;
private static final Font font1 = new Font("FONT", Font.BOLD, 75);
protected JButton b1;
protected JButton b2;
protected JButton b3;
protected JButton b5;
protected JTextField t1;
public Unescapable()
{
t1 = new JTextField("Unescapable");
t1.setText("Unescapable");
t1.setBounds(225, 50, 750, 100);
t1.setForeground(Color.LIGHT_GRAY);
t1.setOpaque(true);
t1.setVisible(true);
t1.setEditable(false);
t1.setBackground(Color.BLACK);
t1.setFont(font1);
b1 = new JButton("Open Window");
b1.setActionCommand("open");
b1.setBackground(Color.GRAY);
b1.setForeground(Color.white);
b1.setOpaque(true);
b1.setBorderPainted(false);
b1.setBounds(280, 200, 390, 40);
b1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
b1.setBackground(Color.BLUE);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b1.setBackground(Color.GRAY);
}
});
b2 = new JButton("Delete File");
b2.setActionCommand("delete");
b2.setBackground(Color.GRAY);
b2.setForeground(Color.white);
b2.setOpaque(true);
b2.setBorderPainted(false);
b2.setBounds(280, 255, 390, 40);
b2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
b2.setBackground(Color.BLUE);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b2.setBackground(Color.GRAY);
}
});
b3 = new JButton("Info...");
b3.setActionCommand("info");
b3.setBackground(Color.GRAY);
b3.setForeground(Color.white);
b3.setOpaque(true);
b3.setBorderPainted(false);
b3.setBounds(278, 330, 185, 40);
b3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
b3.setBackground(Color.BLUE);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b3.setBackground(Color.GRAY);
}
});
b5 = new JButton("Quit Game");
b5.setActionCommand("close");
b5.setBackground(Color.GRAY);
b5.setForeground(Color.white);
b5.setOpaque(true);
b5.setBorderPainted(false);
b5.setBounds(485, 330, 185, 40);
b5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
b5.setBackground(Color.BLUE);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b5.setBackground(Color.GRAY);
}
});
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b5.addActionListener(this);
b1.setToolTipText("Opens Another JWindow");
b2.setToolTipText("Deletes \"text.txt\"");
b3.setToolTipText("Give's some information.");
add(b1);
add(b2);
add(b3);
add(b5);
add(t1);
System.out.println("Main Window Is Running");
}
public void actionPerformed(ActionEvent e)
{
if ("open".equals(e.getActionCommand()))
{
File f = new File("text.txt");
try
{
PrintWriter out = new PrintWriter(f);
out.println("TheBestMacTutorials");
out.close();
}
catch (Exception e2)
{
}
}
else if ("delete".equals(e.getActionCommand()))
{
File f = new File("text.txt");
f.delete();
}
else if ("info".equals(e.getActionCommand()))
{
InfoBook add = new InfoBook();
add.call();
}
else
{
System.out.println("Window Is Now Closing");
System.exit(0);
}
}
private static void createAndShowGUI()
{
JFrame program = new JFrame("My Program");
program.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Unescapable newContentPane = new Unescapable();
program.setContentPane(newContentPane);
program.setLayout(null);
program.setVisible(true);
program.setLocation(850, 445);
program.setSize(900, 580);
program.setTitle("Unescapable 1.0");
program.setBackground(Color.GREEN);
program.isOpaque();
program.isForegroundSet();
program.getContentPane().setBackground(Color.BLACK);
}
public static void main(String[] args)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI();
}
});
}
}
The code for the "Info Book":
public class InfoBook extends JFrame
{
private static final long serialVersionUID = 1L;
private static final Font font1 = new Font("FONT", Font.BOLD, 75);
protected JButton b1;
protected JButton b2;
protected JTextField t1;
public InfoBook()
{
b1 = new JButton("Cancel");
b1.setActionCommand("cancel");
b1.setBackground(Color.GRAY);
b1.setForeground(Color.white);
b1.setOpaque(true);
b1.setBorderPainted(false);
b1.setBounds(280, 200, 390, 40);
b1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
b1.setBackground(Color.BLUE);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b1.setBackground(Color.GRAY);
}
});
b2 = new JButton("More Info");
b2.setBackground(Color.GRAY);
b2.setForeground(Color.WHITE);
b2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
b2.setBackground(Color.BLUE);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b2.setBackground(Color.GRAY);
}
});
t1 = new JTextField("Info");
t1.setText("Info...");
t1.setBounds(225, 50, 750, 100);
t1.setForeground(Color.LIGHT_GRAY);
t1.setOpaque(true);
t1.setVisible(true);
t1.setEditable(false);
t1.setBackground(Color.BLACK);
t1.setFont(font1);
b1.setToolTipText("Opens Another JWindow");
b2.setToolTipText("Gives More Infomation");
add(b1);
add(b2);
add(t1);
System.out.println("Info is now running");
}
public static void creatAndShowGUI()
{
JFrame frame = new JFrame("Info Panel");
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
InfoBook newContentPane = new InfoBook();
frame.setLayout(null);
frame.setVisible(true);
frame.setLocation(850, 445);
frame.setSize(900, 580);
frame.setTitle("Unescapable 1.0");
frame.setBackground(Color.GREEN);
frame.isOpaque();
frame.isForegroundSet();
frame.getContentPane().setBackground(Color.BLACK);
}
public static void call()
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
creatAndShowGUI();
}
});
}
}
I believe thats all the code, and I am not very used to how to format the code in stack overflow, so I might of messed something up. I am probably just getting something messed up, so i am sorry for that but thanks in advance.
The main problem is in your createAndShowGUI in your InfoBook class...
public static void creatAndShowGUI() {
JFrame frame = new JFrame("Info Panel");
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
InfoBook newContentPane = new InfoBook();
frame.setLayout(null);
frame.setVisible(true);
frame.setLocation(850, 445);
frame.setSize(900, 580);
frame.setTitle("Unescapable 1.0");
frame.setBackground(Color.GREEN);
frame.isOpaque();
frame.isForegroundSet();
frame.getContentPane().setBackground(Color.BLACK);
}
Essentially, you create an instance of newContentPane, but you never use it.
But, you're about to run into a second problem...
} else if ("info".equals(e.getActionCommand())) {
InfoBook add = new InfoBook();
add.call();
Here you create an instance of InfoBook, but this instance will have no relationship to the one that is created in your creatAndShowGUI and which I assume you want to show on the screen, so getting information from the class will be impossible
I suspect, you actually want to use a JDialog of some kind instead, which will allow you to present a window to the user, BUT which will block the execution of the code until the user closes the window, at which time you could then interrogate the object for it's information.
See How to Make Dialogs for more details
As a general rule of thumb, you don't want to extend from top level containers like JFrame or JDialog, instead, you want to use a JPanel as the base component and add these to what ever container you need.
Avoid using null layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify
You might also like to have a look at The Use of Multiple JFrames, Good/Bad Practice?
I'm writing a GUI that is able to perform some JUnit Tests and to handle this I have used a SwingWorker.
When I start the program the GUI comes up and I click through some selections and the SwingWorker initiates and does it's part and finally outputs either a console output or file output. Then I would click through the GUI again and start another test. At this point when the program finishes it would generate the final output twice, e.g. the console output would be followed directly by an identical console output.
I am assuming this is due to the SwingWorker not terminating and "dying".
Also I am creating the SwingWorker when I click a "start" button in the GUI. Is this a bad idea and what would the proper way to do it be instead?
EDIT Added code sample
public class TestMainFrame {
private static JFrame frame;
private static JTextArea textArea;
public TestMainFrame(){
createAndShowGUI();
}
private void createAndShowGUI() {
frame = new JFrame("Test");
frame.setLayout(new BorderLayout());
JButton btn = new JButton("Test Me");
btn.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
if(btn.getText().equals("Test Me")){
testMe();
}
}
});
textArea = new JTextArea("This is a test pane! \n");
textArea.setEditable(false);
JScrollPane scroller = new JScrollPane(textArea);
frame.add(scroller, BorderLayout.CENTER);
frame.add(btn, BorderLayout.PAGE_END);
frame.setSize(new Dimension(300, 400));
frame.setVisible(true);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private static void testMe(){
writeToTextArea("Button Pressed");
writeToTextArea("Starting tests");
SwingWorker<Result, Void> worker = new SwingWorker<Result, Void>() {
#Override
public Result doInBackground() {
writeToTextArea("Inside the doInBackground method of SwingWorker");
return null;
}
#Override
public void done() {
writeToTextArea("The SwingWorker has finished");
}
};
worker.execute();
}
private static void writeToTextArea(String text){
textArea.append(text + "\n");
}
(Not an answer)
This is how I ran your code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TestMainFrame {
private static JFrame frame;
private static JTextArea textArea;
public TestMainFrame() {
createAndShowGUI();
}
private void createAndShowGUI() {
frame = new JFrame("Test");
frame.setLayout(new BorderLayout());
final JButton btn = new JButton("Test Me");
btn.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
if (btn.getText().equals("Test Me")) {
testMe();
}
}
});
textArea = new JTextArea("This is a test pane! \n");
textArea.setEditable(false);
JScrollPane scroller = new JScrollPane(textArea);
frame.add(scroller, BorderLayout.CENTER);
frame.add(btn, BorderLayout.PAGE_END);
frame.setSize(new Dimension(300, 400));
frame.setVisible(true);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private static void testMe() {
writeToTextArea("Button Pressed");
writeToTextArea("Starting tests");
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
#Override
public Void doInBackground() {
writeToTextArea("Inside the doInBackground method of SwingWorker");
return null;
}
#Override
public void done() {
writeToTextArea("The SwingWorker has finished");
}
};
worker.execute();
}
// *** note change ***
private static void writeToTextArea(final String text) {
if (SwingUtilities.isEventDispatchThread()) {
textArea.append(text + "\n");
} else {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
textArea.append(text + "\n");
}
});
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
TestMainFrame testMainFrame = new TestMainFrame();
testMainFrame.createAndShowGUI();
}
});
}
}
and I have the following problem.
i am new in java and i am trying to send a variable which is user_id, from JInternalFrame to JFrame.
I can't use constructor because JFrame is the main program activated at startup and containing jDesktoPane
so i was trying to use the methods, however, can't do it (i posted the two methods, both of which I tried but did not work)
Method A)
Code in jFrame (Main_window)
public javax.swing.JTextField getID() {
return jTextField_id;
}
public void setID(javax.swing.JTextField ID)
{
jTextField_id = ID;
}
code in jInternalFrame
Main_window send = new Main_window();
send.getID().setText("123");
Method B)
Code in jFrame (Main_window)
USER_ID is a variable accesible in any place of jFrame
public void setID(String ID)
{
USER_ID = ID;
}
code in jInternalFrame
Main_window send = new Main_window();
send.setID("123");
both method don't change anything but have no errors in compilation
if there is any other way of doing it pls tell me :)
sorry for my language and grammar.
if this help i use Eclipse compilator
this code worked for me, ty for help
public void set_ID(String ID)
{
Test_JF mainWindow = (Test_JF) this.getTopLevelAncestor();;
mainWindow.setID(ID);
}
activated by set_ID("1234");
Try this in your JInternalFrame class:
JFrame mainWindow = (JFrame)this.getTopLevelAncestor();
mainWindow.setID("123");
ok so here is smaller version of my program
"Test_JF" is a main JFrame and "Test_JIF" is a JInternalFrame
here is TestJF
public class Test_JF extends JFrame {
private JPanel contentPane;
private JTextField user_id;
String USER_ID;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Test_JF frame = new Test_JF();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Test_JF() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 750, 500);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
user_id = new JTextField();
user_id.setBounds(338, 11, 86, 20);
contentPane.add(user_id);
user_id.setColumns(10);
JButton button_user_id = new JButton("fill user id");
button_user_id.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
user_id.setText(USER_ID);
}
});
button_user_id.setBounds(239, 10, 89, 23);
contentPane.add(button_user_id);
JDesktopPane desktopPane = new JDesktopPane();
desktopPane.setBounds(10, 56, 714, 395);
contentPane.add(desktopPane);
addWindowListener(new WindowAdapter() {
#Override
public void windowOpened(WindowEvent arg0) {
Test_JIF Open = new Test_JIF();
desktopPane.add(Open);
Open.show();
}
});
}
public void setID(String ID)
{
USER_ID = ID;
}}
here is TestJIF
public class Test_JIF extends JInternalFrame {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Test_JIF frame = new Test_JIF();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Test_JIF() {
Test_JF mainWindow = (Test_JF)this.getTopLevelAncestor();
setBounds(100, 100, 328, 199);
getContentPane().setLayout(null);
JButton button_send = new JButton("New button");
button_send.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
mainWindow.setID("123");
}
});
button_send.setBounds(111, 73, 89, 23);
getContentPane().add(button_send);
}}
i clear imports here(on web) so it will be cleaner
i tried to fix it with revalidate() & repaint() but it didn't work out for me, i searched for some more solutions, but everytime i try it doesn't work for me, could anyone help me please?
thanks alot,
Here is my script (not full)
public JPanel createPanel() throws SQLException, ClassNotFoundException
{
FormLayout formlayout1 = new
FormLayout("FILL:DEFAULT:NONE,FILL:119PX:NONE,
FILL:30PX:NONE,FILL:24PX:NONE,FILL:130PX:NONE,
FILL:16PX:NONE","CENTER:DEFAULT:NONE,CENTER:30PX:NONE,
CENTER:30PX:NONE,CENTER:25PX:NONE,CENTER:25PX:NONE,
CENTER:25PX:NONE,CENTER:25PX:NONE,CENTER:25PX:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
JLabel lbl = null;
JTextArea col = null;
int i = 3;
for (OverzichtVo o : OverzichtBusiness.getOverzicht()){
lbl = new JLabel(mapServices.get(o.getServiceid()));
jpanel1.add(lbl, cc.xy(2, i));
col = new JTextArea();
col.setEditable(false);
LineBorder lineborder1 = new LineBorder(new Color(0,0,0),2,false);
col.setBorder(lineborder1);
col.setBackground(colors[o.getStatusid()-1]);
jpanel1.add(col, cc.xy(3, i));
lbl = new JLabel(o.getExtrainfo());
jpanel1.add(lbl, cc.xy(5, i));
i++;
button.setFont(new Font("Poor Richard",Font.PLAIN,20));
button.setName("button");
LineBorder lnbord = new LineBorder(new Color(0,0,0),2,false);
button.setBorder(lnbord);
refresh();
jpanel1.add(button,cc.xy(5,2));
m_lbloverzicht.setFont(new Font("Poor Richard",Font.PLAIN,30));
m_lbloverzicht.setName("lbloverzicht");
m_lbloverzicht.setText("Overzicht");
LineBorder lineborder1 = new LineBorder(new Color(0,0,0),2,false);
m_lbloverzicht.setBorder(lineborder1);
jpanel1.add(m_lbloverzicht,cc.xy(2,2));
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7,8 });
return jpanel1;
}
private void refresh(){
button.addActionListener(new ActionListener(){
#Override
public void actionPerformed(ActionEvent e)
{
jpanel1.revalidate();
jpanel1.repaint();
}
});
}
and i activate it all in another class :
public static void main(String args[]) throws SQLException, ClassNotFoundException{
JFrame frame = new JFrame();
AlgemeneFrm frm_alg = new AlgemeneFrm();
frame.add(frm_alg);
frame.setVisible(true);
frame.setSize(350,250);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent evt)
{
System.exit(0);
}
});
}
I'm trying to refresh my whole Jpanel/panel cause my Jtextarea(background) is green, when i change something it's suppose to go red. that works fine for me if i stop application and start it again, but i added a button, so i could refresh/update my application or just panel. but it won't work with my 'refresh' button within 'panelname'.revalidate();and 'panelname'.repaint();
help please