Questions tagged [jframe]

A JFrame is a component and top-level container of the JFC/Swing framework.

jframe
Filter by
Sorted by
Tagged with
0 votes
1 answer
156 views

Why my JFrame is not appearing

Can anyone explain me or suggest a solution to the following problem? I have two projects in eclipse workspace, and in the projectA this class runs just fine: public class Example extends JFrame { ...
nevena's user avatar
  • 21
1 vote
3 answers
764 views

Window size is wrong or not setting in Swing

This is my first swing application. I'm trying to create an window and add a button. On clicking the button, it should display some value on the console. Everythign works fine, but the window is very ...
user3690707's user avatar
1 vote
1 answer
729 views

how to accept keyboard shortcuts when jframe is not in focus?

I made an application using java which takes and stores screenshots in the specified folder. I set the shortcut ctrl+K to take and save the screenshot and I managed to make my application minimize to ...
user3626393's user avatar
0 votes
1 answer
122 views

Access Canvas From JFrame

I am adding a Canvas to my JFrame - or rather, an object that inherits from Canvas - and then I wish to get that Canvas object from the JFrame, cast it to that object that inherits from Canvas, and ...
TheUnrealMegashark's user avatar
0 votes
2 answers
616 views

Is there a way to make JTextField for my address bar larger and curvier

I'm making a browser just to practice my Java skills, is there a way to make my address bar which is a JTextField, larger instead of the swing's default value and also curvier. Here's my code. /...
Reuben Ukah's user avatar
2 votes
2 answers
4k views

Displaying a JLabel text on top of a drawing

i can't figure out how to make this work. I created a main class, extended in JFrame. If I run the program with the draw() and paint() methods to draw something, my label is not visible. If I just ...
Dren Skywalker's user avatar
0 votes
1 answer
742 views

Java: Can multiple instances of a jPanel access a variable stored in the jFrame they exists?

I am creating a Java application which exists out of a jFrame that is empty upon start and can include an undefined amount of instances of a jPanel. image: The idea is that every time the user ...
Bjorn De Rijcke's user avatar
-1 votes
2 answers
1k views

How to switch back to previous JFrame from another JFrame?

I am a student who is trying to create a simple application using Leap motion controller API's. So, what I have is a screen on which I am performing a circle gesture to go to next screen. I have ...
Samarth's user avatar
  • 35
0 votes
1 answer
189 views

Setting fullscreen using other ways besides getting screen size in Java

I was wondering if there was a way that is better than using the Toolkit.getDefaultToolkit().getScreenSize().getHeight()/getWidth(); and then using that as the dimensions for the JFrame and then ...
Garrett's user avatar
  • 17
0 votes
3 answers
6k views

Changing color of frame when radio button is used

I am trying to change the background color when a radio buttion is used. Right now I have the frame, and buttons(red,green, and blue) showing. I set up a method to change the color when a button is ...
Hulu's user avatar
  • 13
1 vote
1 answer
81 views

How do I get my Card (JComponent) to appear fully in my JPanel when I add it to my JFrame?

At the moment, all i see is a thin black line extending from the top left corner of the JFrame screen. I am assuming it is the bottom edge of my card and the rest is blocked from view When i added ...
Anonymous Noob's user avatar
-1 votes
1 answer
346 views

Java Graphics.drawImage() isn't drawing at right position

JFrame m = new JFrame(); m.setPreferredSize(new Dimension(512, 448)); m.setResizable(false); m.pack(); m.setVisible(true); BufferedImage img = null; try { title = ImageIO.read(new File(&...
SuperDisk's user avatar
  • 2,780
1 vote
3 answers
134 views

Last button in JFrame is set as background?

import javax.swing.JButton; import javax.swing.JFrame; public class Test extends JFrame { private static final long serialVersionUID = 1L; public Test() { super("A test"); ...
Adz's user avatar
  • 2,839
0 votes
1 answer
103 views

Java - Jbuttons not appearing in JFrame

I want to make a title screen for my game which involves a title screen. Having just a jframe works and lets me use absolute positioning(i know its not great but its what i intend to use unless i can ...
PencilPerson's user avatar
0 votes
3 answers
143 views

Does clicking on a JTextField call the actionPerformed method

I have multiple JTextFields and I want to see which one is selected within the program. At the moment it does not seem as though clicking on the JTextField calls an ActionEvent (is that how you phrase ...
TwoShorts's user avatar
  • 548
0 votes
2 answers
96 views

Java switching jpanels and new panel doesnt respond

I start my game with a JFrame which starts a JPanel. That JPanel then moves on to the next one when its ready. I can switch to the new JPanel but it does not respond to my keypresses. The second ...
LazerWing's user avatar
  • 111
0 votes
4 answers
349 views

Jframe not Disposing

So i'm working on a text based game in Ready for Java. I was able to find a way to put an image on screen, but when i try to use frame.dispose(); to remove image it gives me a NullPointerException. ...
user3681915's user avatar
1 vote
1 answer
40 views

getting rid of unwanted change of focus between jframes

okay, here is the problem, I am writing a simple chat program. a client has a JFrame called the ChatList class that contains a JList which shows online users. The list is refreshed with new status of ...
Peggy's user avatar
  • 395
0 votes
3 answers
361 views

JComboBox ,itemStateChanged

import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Count extends JFrame implements ItemListener { private JComboBox box; private static String[] num = {"5", "6", "...
BlueSky's user avatar
  • 11
0 votes
3 answers
2k views

JFrame Layering/Overlapping

I'm working on a Java game and my main issue is putting more than one component on a Jframe at once. Before you all yell at me, I HAVE done what was suggested in terms of layout managers and component ...
user3670002's user avatar
0 votes
0 answers
374 views

Use jTextField text in one JFrame in a seperate JFrame

Two hours of google searches and I now do admit defeat. I am working on a simple java program but I just can't figure out how to get the text from one jTextField to equal the text of another ...
is-cj's user avatar
  • 3
-2 votes
2 answers
78 views

Arraylist not public in my program [closed]

I made a Jframe in Netbeans and using an initialize button, it displays five CDs. I have an add button, but when I type CDs (my arraylist's name).add it shows an error. public class GUI extends javax....
TheOfficialMud's user avatar
0 votes
1 answer
60 views

JButton won't Remove

Sorry for the newbish question, but I am new to JStuff. I have seen a bunch of different ways to remove a JButton, but none of them seem to be working. Can anyone tell me what I am missing here, ...
Evorlor's user avatar
  • 7,309
-1 votes
1 answer
115 views

JButton disappears when adding JTextrea

I'm having an issue with my Java program where I can add a JButton to the panel in JFrame, but when I create an JTextArea object, the JButton disappears? package sandBox; import java.awt....
Elliott Coe's user avatar
0 votes
3 answers
7k views

How to make a button invisible when clicked in java?

I am working on a project from a textbook and I'm stuck. The goal is: When the GUI first appears, both buttons are visible, but when one button is clicked, that button disappears and only the other ...
user2668069's user avatar
-2 votes
2 answers
778 views

How to redirect user from one frame to another? [closed]

I'm trying to set a logon frame using Java Swing - Eclipse. I can't find how to redirect the user to another frame on success of the operation. Any brilliant idea, please?
Lucie kulza's user avatar
  • 1,357
1 vote
0 answers
272 views

Setting zoom in gral plot results in empty plot

I have the following code for generating a plot for my data : import // ... import javax.swing.JFrame; import de.erichseifert.gral.data.DataTable; import de.erichseifert.gral.io.plots....
Patryk's user avatar
  • 23.4k
0 votes
1 answer
522 views

disable -enable jframe eclipse

I am trying to Enable my mainJframe after disabling it to use another jFrame. i disable it after : actionPerformed with : frame.setEnabled(false); the 2nd jFrame works and closes just fine, but I ...
Vicki K's user avatar
  • 23
0 votes
0 answers
51 views

How to display another JFrame by creating its object in main class

Action Listener in main class play.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Game g= new Game(); add(g); } }); Constructor of Game class ...
ABC's user avatar
  • 33
1 vote
1 answer
10k views

Multiple panels in JFrame

The useless Layout Manager guy is back again, I just can't seem to get my head around these darn layouts and make them work the way I want. Anyway, I want to have a JFrame which has one large panel ...
candrews13's user avatar
0 votes
2 answers
74 views

Can not set size for frame

i want to set a size for frame but i cant, why? the frame is in createandshowgui method i did set for frame,table everything but didnt do anything, i want to set 1024x768 public static class ...
user3633989's user avatar
0 votes
4 answers
65 views

How to implement layout?

I have a GUI program which includes JLabels and JButtons and basically I want a layout that would help me display them as follows: Label1 Button1 Label2 Button2 Label3 Button3 ..... Is ...
user3353723's user avatar
1 vote
2 answers
5k views

Runnable JAR file not opening JFrame

I am having a mysterious problem with my JAR file not running. My game opens a JFrame object, in which all of the graphics are displayed. Everything works in Eclipse, but when I try to export my ...
SecondThread's user avatar
0 votes
0 answers
414 views

getting the pixel color of where the mouse is?

So part of my program requires me to get the RGB value of wherever the mouse is above IN THE JFRAME. It's not working though, and I'm not entirely sure if the x,y coordinates im using for ...
user3672773's user avatar
0 votes
1 answer
4k views

how to update the jcombobox immediately when the table in database get updated in java

I am working on java application.I have two frames in application.I want to reflect data entered in one frame into another frame run time. As shown in above window when I press submit button in ...
rachana's user avatar
  • 3,364
0 votes
2 answers
862 views

Java setShape() method giving error on command prompt but works fine on eclipse

I am trying to change the shape of my main frame using frame.setShape(new RoundRectangle2D.Double(1,1,863,590,80,80)); this method is working perfectly on eclipse but when I compile the program ...
Abdul Moiz Farooq's user avatar
2 votes
2 answers
1k views

How do I set the size of a JButton?

The button takes up the whole screen, and I try using setSize() but that doesn't appear to be doing anything. Here's my code so far: JButton start = new JButton("PLAY"); start.setSize(new Dimension(...
lehermj's user avatar
  • 926
2 votes
1 answer
739 views

JFrame only updates when resized [duplicate]

I am writing a program for a Golf Simulator. Up to this point, it essentially works as intended, but the window only updates when I drag to resize it. Why would this be? I have attached the relevant ...
user17902's user avatar
1 vote
1 answer
243 views

Setting the size of JPanel that contains JRadioButton

I have some problem , i want my jpanel to look like this but after codING i had this view and i didnt find the solution , i need some helps please. i put the radio button inside jScrollPan //...
Malek Djelassi's user avatar
0 votes
1 answer
48 views

Blank Frame for no apperent reason [duplicate]

Program is Compiling and running but it is not displaying anything on the frame just a blank screen. i am making main menu for my game using cardLayout, i have made different classes for every panel ...
user3516817's user avatar
0 votes
0 answers
47 views

Error while build project "uses unchecked or unsafe operations" [duplicate]

I don't know why this happens. Error details Note: C:\Users\mcsentul\Documents\NetBeansProjects\HitungListrik\src\hitunglistrik\HitungListrik.java uses unchecked or unsafe operations. Note: ...
Muklas's user avatar
  • 587
0 votes
3 answers
858 views

Run netbeans java project in browser

How is it possible, to run netbeans project in the browser? My project have only one frame, and uses swing. I have no idea, how is it possible, to write an embedded java application, for browsers.
Iter Ator's user avatar
  • 8,618
2 votes
4 answers
6k views

How to use frame.add method to create multiple visible objects

When I try to add a second instance of an elevator class, the first one disappears. How can I rearrange this code in order to see both objects? Here is my main class: public class MainClass extends ...
user1432671's user avatar
0 votes
1 answer
49 views

JFrame check boxes interaction

I would like to ask you something about JFrame and I think that I am wrong somewhere because this is happening: I have placed on my Window Form 2 checkboxes (DocumentCheckBox and FilescheckBox). Here ...
user3358377's user avatar
0 votes
3 answers
201 views

JButton covers other buttons

I have been stuck in this for a while. The problem is that I want to shift my button to the right side of my screen, but when I use borderlayout.east it removes the other button that I created. Can ...
logger's user avatar
  • 2,023
-1 votes
2 answers
10k views

How to move a circle automatically in java? [closed]

I am new to java GUI, and am trying to learn it. I want to move a circle on screen automatically(i.e not by pressing any key or doing any other action). I found a way to move it by doing some action ...
Waz's user avatar
  • 55
-1 votes
3 answers
157 views

Multiples JFrame does not repaint properly

I am creating a simple application for test purposes that displays a couple of JFrames separately, and each one contains an image. The problem is that it displays the number JFrames expected based on ...
Patrick Bard's user avatar
  • 1,809
1 vote
2 answers
1k views

How to animate Rectangle in JPanel?

I want to learn some tricks about JAVA for my project. I want to animate my Rectangle leftoright and righttoleft but I can't apply the same functions for ball animation. In addition,how can I start ...
user avatar
1 vote
2 answers
78 views

How to shorten this KeyListener code

I am using this code to detect when the user presses an arrow key in my program. I need which arrow key was pressed to be sent to a method which will process it and do what it needs to do. It's ...
user3665713's user avatar
2 votes
3 answers
107 views

Why is my JPanel not showing on a JFrame?

I have made a calculator by referencing to another's source code, but as I try to compile the file, the frame will display, leaving the panel and simply showing nothing but a blank frame. I use a ...
Munkeeface's user avatar

1
114 115
116
117 118
200