setvisible

Problem with setVisible (true)

The two examples shown below are same. Both are supposed to produce same result e.g. generate the coordinates of images displayed on JPanel. Example 1, works perfectly (print the coordinates of images), however example 2 returning 0 for the coordinate. I was wondering why because, I have put the setvisible (true) after adding the panel...

How do I remove an old JPanel and add a new one?

I would like to remove an old JPanel from the Window (JFrame) and add a new one. How should I do it? I tried the following: public static void showGUI() { JFrame frame = new JFrame("Colored Trails"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(partnerSelectionPanel); frame.setSize(600,400); ...

how to ensure that JDialog always stays on top

Hello everyone I have a JDialog that takes a name from the user. Behind the JDialog, is an applet. I dont want the user to access that applet until he has entered the name. I tried JDialog.setAlwaysOnTop(true), but the applet throws an AccessException error. So what I did was keep a while loop that will execute JDialog.setVisible(true) ...

Is it Possible to show a previously hidden JFrame using a keylistener

here is my code, i basically just did a tester for the most common listeners, which i might later use in future projects, the main problem is in the keylistener at the bottom, i am trying to re-show the frame but i think it just cant be done that way, please help ps: no idea why the imports dont show up right. package newpackage; impor...

setVisibility not working within ViewFlipper

I'm trying to disable a TextView within a ViewFlipper via setVisibility to GONE and cannot get it to act like I'm wanting. My code: switch(index) { case 0: //Do Stuff findViewById(R.id.o2).setVisibility(8); findViewById(R.id.o3).setVisibility(8); break; case 1: //Do Stuff findViewById(...