jframe

Reinstantiating a GUI (JFrame) object

Hi guys, basically I want my JFrame to become a completely new JFrame object when an event is triggered. I have some code that basically calls [CODE]GUI gui = new GUI(x, y)[/CODE] the only problem I'm having is that as well as creating the new GUI object, it is not deleting the old window. Can anyone tell me how to get rid of the old win...

Swapping out the center JPanel in a BorderLayout

I have a JPanel sitting inside the center position of a BorderLayout of a JFrame. How can I swap out the current JPanel for a new one? ...

how to create an array of JLabels in Java to be printed on a JFrame

I m trying to make an array of labels each label has a differented value which come out of a function. I dont know the exact no. of labels to be used i mean there could be any no of values to b printed Therefore, please help me do so ...

add JButton into frame with JTable

hello, I would like to know how to put a button inside a frame that contain JTable inside. (The button should not be inside a cell, but after the table ends) Here is the example code I wrote so far: class SimpleTableExample extends JFrame { // Instance attributes used in this example ...

Best Practice With JFrame Constructors?

In both my Java classes, and the books we used in them laying out a GUI with code heavily involved the constructor of the JFrame. The standard technique in the books seems to be to initialize all components and add them to the JFrame in the constructor, and add anonymous event handlers to handle events where needed, and this is what has...

I have a JFrame problem

hi how can we create a main JFrame with background image and a JFrame inside the main JFrame with Java Swing? thank you very much ...

JFrame is not acting as expected!

This is my first time using a JFrame. I can't get the window to display the text areas I've nested inside the JFrame. I am trying to get the text field with my name in it to display above the tabulated results, which I have omitted the formatting for until I can get the JFrame to work. public void printResults(String[] names, int[] temp...

How to keep Java Frame from waiting?

I am writing a genetic algorithm that approximates an image with a polygon. While going through the different generations, I'd like to output the progress to a JFrame. However, it seems like the JFrame waits until the GA's while loop finishes to display something. I don't believe it's a problem like repainting, since it eventually does d...

setting something disposed or invisible java

changed the project since its working now. kinda. the image still isnt changing. package icnon; import javax.imageio.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class FrameIconExample extends JFrame implements ActionListener { JLabel j; JPanel p, l, k; JButton picOne, picTwo; Container...

Open a window-popup from JMenuItem java

I have a JMenu with a JMenuItem, and when I click on this, I need to open a JFrame or window, in other words a component with inside JButton, JTextField,... How can i do this ? ...

How to add support for resizing when using an undecorated JFrame?

I would like to customize my titlebar, minimize-, maximize- and the close-button. So I used setUndecorated(true); on my JFrame, but I still want to be able to resize the window. What is the best way to implement that? I have a border on the RootPane, and I could use MouseListeners on the Border or the RootPane. Any recommendations? imp...

Setting minimum size limit for a window in java swing

I have a JFrame which has 3 JPanels in GridBagLayout.. Now, when I minimize a windows, after a certain limit, the third JPanel tends to disappear. I tried setting minimizing size of JFrame using setMinimumSize(new Dimension(int,int)) but no success. The windows can still be minimized. So, I actually want to make a threshhold, that ...

How can I customize the title bar on JFrame?

I would like to have a customized title bar in my Java Swing desktop application. What is the best way to do that? I can use a "Swing-title bar" by using the following code in the constructor for my JFrame: this.setUndecorated(true); this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); But how do I customize it? Is there any ...

Add a Transparent image to window background in Java using Netbeans

how to add a background image with transparency to a jFrame in Netbeans. I have added a jPanel to jFrame and all components are in this panel. Also Netbeans allows me to preview various designs for the jFrame. How to apply these designs? I can't find the option to save it. ...

How can I change jtable height at runtime

I hava a JFrame with multiple JPanels of similar width aligned one below other. I use one of these JPanels to display a JTable which is the last JPanel of the lot. This JPanel has a JScrollpane as a child component. This is where I try to add my table dynamically. Initial height of this JScrollpane is set to 40. I designed above templat...

"Forwarding" keypresses from an applet to a JFrame

I have a JFrame which contains a JApplet. There are shortcut keys that I have configured for the JFrame that work fine when the focus is on some panel of it, but once I click into the applet, none of the shortcut keys work anymore. Is there any way that I can forward these key presses to the JFrame so that the events are still fired? ...

login form with java/sqlite

hi I would like to create a login form for my application with the possibility to add or remove users for an sqlite database, i have created the table users(nam, pass) but i can't unclud it in my login form, it someone could help me this is my login code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public cl...

JFrame does not refresh after deleting an image

Hi! I'm working for the first time with images in a JFrame, and I have some problems. I succeeded in putting an image on my JFrame, and now i want after 2 seconds to remove my image from the JFrame. But after 2 seconds, the image does not disappear, unless I resize the frame or i minimize and after that maximize the frame. Help me if you...

Bad event on java panel

Hi I have a java panel with 4 buttons. When I click on of these buttons, a new frame appears and the first is hidden with setVisibile(false). On that new window, I have another button, but when i click it, I got the event corresponding to the fourth button of the first window. Clicking the button again does the trick, but of course t...

Make JFrame / JPanel unclickable

I have a JFrame with an associated JPanel which fill the screen, both having setFocusable(false) and in Front another JFrame with a Jpanel with a fixed size and centered (both are unmoveable). In this 'front' Panel theres a game, but when i click on the background Frame the front Panel moves to the background i only see the (dark grey) b...