jframe

Removing JPanel from a JFrame in netbeans

So, I have several JPanels that contain buttons, labels, etc. that I want to switch between from a main JFrame. Currently I am trying to use the this.add(JPanelname); method and this.remove(JPanelname); with the validate(); and repaint(); methods The problem is it will add the panel to the JFrame but it will not remove it. I am not sur...

Frame Showing Problem

Hey Guys I have made one project which is showing the inventory of the stock of one store. In that inventory the software should store data of the products with their images. There is one problem... Bcz of the lots of stock, the screen on which is image is loading taking a lot of time. So, i thought i should give the frame in which there...

How can you generate a JFrame in a Random Location?

As in wen you run any output in a frame, every time you run the program it pops on a different position on the screen? ...

How to activate and deactivate frame in java?

hey guys I had made one application in java-swing, Now what i am getting problem is, i want to minimize my jframe when it is deactivate and then to maximize i want to activate that window. So for maximize, i want to activate any jframe using java code. So how to activate and deactivate any jframe, so that i can do something on window l...

Getting data from JFrame AFTER the form is filled

I'm trying to get data for my application from a form set in an external window (getDataWindow extends javax.swing.JFrame). The problem is that functions are executed before form is filled in. getDataWindow dataW=new getDataWindow(); dataW.setVisible(true); size=dataW.returnSize(); I've tried also adding additional boolean...

Nothing happen when refreshing the main Frame (JAVA)

Hello everyone, I try to show a ( Logged in ) message when a user is succefully connected but nothing happen when a do a repaint(). you can take a look to the code : public class MainFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private static final int FRAME_HEIGHT = 400; ...

problem in adding image to JFrame

Hi, I'm having problems in adding a picture into JFrame, something is missing probebly or written wrong. here are the classes: main class: public class Tester { public static void main(String args[]) { BorderLayoutFrame borderLayoutFrame = new BorderLayoutFrame(); borderLayoutFrame.setDefau...

Why do people run Java GUI's on the Event Queue

In Java, to create and show a new JFrame, I simply do this: public static void main(String[] args) { new MyCustomFrameClass().setVisible(true); } However, I have seen many people doing it like this: public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { ne...

Java SystemTray and JFrame.

Hello All, I am work on desktop application in which I required a functionality which will take an snap of desktop and then will show it on a Jframe to user in 150X150 size. I am able to take an snap of desktop using robot class of awt and also able to show it on a JFrame as well but when it appear or displayed it will take all the cont...

How to disable main JFrame when open new JFrame

Example now I have a main frame contains jtable display all the customer information, and there was a create button to open up a new JFrame that allow user to create new customer. I don't want the user can open more than one create frame. Any swing component or API can do that? or how can disabled the main frame? Something like JDialog. ...

Getting a JFrame's actual current location

Hello community, I am trying to create a (child) JFrame which slides out from underneath one side of a second (parent) JFrame. The goal is to then have the child follow the parent around when it is moved, and respond to resizing events. This is somewhat related to this question. I have tried using a ComponentListener, but with this met...

ActionListener isn't Implementing

JFrameWithPanel is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class JFrameWithPanel extends JFrame implements ActionListener I Don't get this code. Book and Java site tells me this is the syntax for the method, but again this error shows up const...

Updating text on JFrame depending on ActionListener

This is a result of ActionListener. Depending on what he chooses in the Combo Box it returns a price. I just want it as a simple $39.99. Nothing more. I have the packageIndex = packageChoice.getSelectedIndex(); All the prices are in an array: String[] prices = {"49.99, 39.99, 34.99, 99.99"} Now I need to know how to pull the pr...

Unexpected return value

Program stopped compiling at this point: What is causing this error? (Error is at the bottom of post) public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[] prices = {49.99, 39.99, 34.99, 99.99}; DecimalFormat money = new DecimalFormat("$0.00"); ...

How to close a JFrame in the middle of a program

public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[] prices = {49.99, 39.99, 34.99, 99.99}; DecimalFormat money = new DecimalFormat("$0.00"); JLabel priceLabel = new JLabel("Total Price: "+price); JButton button = new JButton("Check Price")...

ALWAYS on top window

Hey, I'm searching for a solution in order to keep a JFrame always on top and with always I really mean always. setAlwaysOnTop( true ); This won't work when I'm starting a game in fullscreen mode. I know you normally don't want your windows to stay on top but in this case it's required. ...

Java: I can't interact with my JFrame

Hi, I have a java application (1.4.2) that uses 2 JFrames. The first is Modal=true and appears on top of the second JFrame. The first JFrame allows the user to "open" a file. Once the file is ready to be displayed, the JFrame is set to setModal=false, and this.dispose() 'd of. This leaves only the second JFrame on the screen. Howev...

How to manage a BorderLayout with generic JPanel()

Im not sure how to reference to JPanel when it was declared like this. This is the coding of the entire program: Everything works but the layout is not how I want it. adding BorderLayouts to it doesnt seem to work. class FrameDemo { public static void main(String[] args) { final JFrame frame = new JFrame("CIT Test Progr...

Cannot find Symbol = new

Java is complaining! cannot find symbol symbol : constructor Bar() location: class Bar JPanel panel = new Bar(); ^ QUESTION: Why am I getting this error?...everything seems to be correct. this is the coding: public class JFrameWithPanel { public static void main(String[] args) { ...

JFrame not working correctly

This is making me very angry, I have worked on this for 2 days, have 2 books open and have looked through them, and STILL can't get this program to run the way I want it run. I'm getting to the point where if this doesn't help, I quit. I want a SIMPLE Frame application. It has a JComboBox centered at the top. Next to it is a text field...