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
147 views

Java - paint method in subclass not working

I'm new to Java and I am currently developing a GUI for a Blackjack game. I am having problems displaying components on a screen via the paint method. The paint method is located in a subclass called ...
magic_broom's user avatar
0 votes
4 answers
1k views

Array Index Out Of Bounds Exception error [duplicate]

i try create a window but i got the following error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 at CreateProject.Window.main(Window.java:20) enter code here public ...
Ayza Ali Khan's user avatar
2 votes
1 answer
6k views

Java: How to open a webpage like Google in a JFrame/JPanel?

I've looked around and everything always end with www.google.com looking like this: Webpage bug? How can I open a webpage within a JFrame/JPanel and have it so that it looks like the normal whole ...
FOD's user avatar
  • 333
0 votes
1 answer
182 views

How can I add an elliptical border to a JFrame

I have an undecorated JFrame in the shape of an ellipse, that I would like to add a border. I am hoping I don't have to implement the rootPane.paintComponent method, and that I can just do this by ...
vinnygray's user avatar
  • 171
1 vote
1 answer
1k views

java - Setting Buttons and TextAreas at locations

So I've been looking at other solutions to this problem, but it seems that none of them help at all. Can someone help me? Code: public static void main(String[] args) { JFrame frame = new ...
Xephos's user avatar
  • 63
0 votes
0 answers
137 views

Java Connect four error

I have made a graphics version of connect four but when I run the program it gives many error, can someone tell me what is wrong with my code? Right now this code is not reading anything and I don't ...
jack zhang's user avatar
1 vote
1 answer
760 views

Why does getContentPane().getWidth() return 0?

I have a class Window that extends JFrame and a class Content that extends JPanel. An object of Content is added to an object of Window. Class Window: public class Window extends JFrame { ...
so.koni's user avatar
  • 35
0 votes
1 answer
38 views

How to use a method from an already to Cotainer put JLabel?

I have to programm a Shikaku-Game and I have no the problem that I can not use one of the setLine-Methods from the ViewIcon-Class in the mouseReleased-Method of the class MyMouseAdapter. Do you know a ...
Kawa's user avatar
  • 11
0 votes
2 answers
72 views

Created a passwordfield in java that is supposed to log in and allow you to move to second Jframe, it doesnt work?

I'm trying to do a log in I've gotten the username to work but the password is failing hard, I've tried multiple techniques and different ways and all of them have failed, my last effort seems to do ...
Hava Nasar's user avatar
0 votes
2 answers
76 views

Cannot put image in Frame

I am a beginner programmer trying to create a Pacman game using Java eclipse. I am at the beginning of the process and I'm simply trying to get my main "Princess Pacman" character on the JFrame screen,...
Aliya's user avatar
  • 3
0 votes
1 answer
672 views

Extension of JDialog (hidden?) not showing up in front of parent JFrame?

I have an application I'm making for a game to automatically update a game client. Once you press Launch, it will open up my DownloadFrame (extends JDialog), and will look like this: If you click ...
Null's user avatar
  • 1
1 vote
1 answer
45 views

Java movement issus in JFrame

I made a program where there is a green square in the JFrame and you press the key "A" and "D" to move left and right (A=left, D=right). But when i run the program the square won't move when the A/D ...
jack zhang's user avatar
1 vote
1 answer
338 views

Adding two panels to a JFrame in Java

So what I'm trying to do is have 2 panels (it has to be panels) inside of a JFrame and have 1 a certain size, the other a smaller size and having the smaller sized one painted a certain color. public ...
X1XX's user avatar
  • 141
0 votes
1 answer
567 views

Difference between actionPerformed and keyPressed in Netbeans

I have started a project in Jframe Netbeans. One thing which bothers me is this option where on one side I have actionPerformed which contains the action which we do when the key is pressed but again ...
user avatar
0 votes
0 answers
136 views

How to use component from another form

I am using Java Swing and I have 2 classes. A.class and B.class. B.class is purely a JFrame form with a simple textarea. A.class is the main class and I wish to call B.class from A.class. I know I can ...
dorothy's user avatar
  • 1,243
5 votes
2 answers
111k views

How do I draw a triangle?

I know how to draw a rectangle and circles and ect with g.drawRect or g.drawOval. But there is no g.drawtriangle. Is there a way to draw a triangle with out me having to draw it out each side of the ...
jack zhang's user avatar
0 votes
1 answer
137 views

Make this cube's movement smoother?

I've been working the movement of this cube, however, its movement is pretty ugly and sudden, so is there anyway that I could make it "smooth" and "clean"? Here is my code: import javax.swing.*; ...
Pet Lamb's user avatar
-2 votes
1 answer
166 views

javax.swing.JFrame doesn't contain setDefaultCLoseOperation

I'm trying to add a setDefaultCLoseOperation(JFrame.EXIT_ON_CLOSE) line in my code. But it seems that for some reason javax.swing.JFrame doesn't contains setDefaultCLoseOperation. Netbeans put a red ...
Peyu's user avatar
  • 411
1 vote
1 answer
532 views

JFrame not showing JPanel and other widgets in Java

So here's my code, I'm still a newbie in GUI for Java (just started this week). From what I understand, you create a JFrame, to which you add JPanels to, then on those panels you can add widgets like ...
X1XX's user avatar
  • 141
0 votes
0 answers
832 views

Netbeans JFrame getting a button to link to a text box

I'm doing a huge project for my programming fundamentals course to make a menu for a beauty salon and I'm pretty much done with the code to make it work, but i want to make a graphical user interface ...
Mykle's user avatar
  • 1
2 votes
1 answer
2k views

Typing into a text field then appending it to the text area getting weird output-GUI JAVA

so i'm trying to implement a simple GUI program whereby the user types in the text field then when he presses enter, the text is appended to the text field but i'm getting this kind of output: Here's ...
Manisha Singh Sanoo's user avatar
-1 votes
2 answers
97 views

How do you set your JFame's size to be as big as your computer's screen in java?

I wanted to make a game in java, but i don't know if there is a way to set the size of the JFrame to cover the whole computer screen without actually going and setting the size myself to try to match ...
jack zhang's user avatar
0 votes
0 answers
329 views

How do I dynamically update the JFrame with new data instead of a button

So I have a Jframe with 5 buttons. One of the buttons allow the user to add products to the inventory. The other buttons won't work until the user has added something to the inventory. Once the user ...
Deathslice's user avatar
0 votes
1 answer
86 views

Swapping JPanel, 2nd JPanel doesn't display

I have a JFrame and 2 JPanels. One panel is the start screen with buttons. The other panel is the game screen. When I remove the start screen and display the game screen nothing happens to the ...
gingerdev's user avatar
  • 139
0 votes
1 answer
1k views

Grid in the center of BorderLayout

i have been trying to make a 2x2 grid in the dead center of this but i cant.either the grid will cover the rest or it will fit but i will be able to see only the last button.. import javax.swing.*; ...
user avatar
0 votes
1 answer
215 views

What is wrong with my listener?

I have created the interface gui and added the buttons. But now I am stuck with the "Steady" button. When I click it I want to the circle "light bulb" to change color from yellow to orange. What am ...
Leo's user avatar
  • 9
0 votes
1 answer
287 views

In a jframe, can I choose what component is selected on start up?

For example, can I have a certain JTextField be selected and ready to type in when the program starts? How do I do this? Thanks in advance for the help.
user4682154's user avatar
0 votes
1 answer
8k views

How do I link to classes together on java

I have 2 classes running on one project. One class is an implement and the other is a GUI, now what I want is for the GUI to seek code from the implement class. My program is a module Calculator, a ...
Mohamed's user avatar
-1 votes
1 answer
58 views

Java jframe disposing issue

Well I have certain buttons on one frame when they are clicked they change colour. I have a "X" button at the top that disposes the frame. When i try to reopen the frame it opens, but when I click ...
AcDSa's user avatar
  • 1
0 votes
1 answer
1k views

Getting the coordinates of the panel

Using mouseevents, I am able to get the x and y coordinates of the frame, yet I am unable to get the x and y coordinates of the panel. The below codes are me getting the x and y coordinates of the ...
Ski's user avatar
  • 111
0 votes
1 answer
465 views

How to add a row to JTable after populating data using DbUtils.resultSetToTableModel?

I have a JTable defined in this way: public JTable table_1; model_3 = new DefaultTableModel(); table_1 = new JTable(model_3); scrollPane_5.setViewportView(table_1); Add row: model_3.addRow(new ...
Bernard's user avatar
  • 4,320
1 vote
1 answer
2k views

How to switch back and forth between JFrames

To start I am just playing with buttons and JFrame. The issue is that I can switch from one Jframe to the next with a few lines of code here... JButton studentLoginButton = new JButton("Student");...
Layman's user avatar
  • 89
1 vote
0 answers
107 views

JOGL GLCanvas resizing fails after a setVisible() call from another frame

I have a problem with JOGL. I`d like to create two windows. One with a GLCanvas and another one with something else. Every time I call setVisible() of another frame before calling setVisible() of the ...
Kanteran's user avatar
0 votes
1 answer
516 views

How to make a JFrame stays always on bottom?

In Java there is this method that make a JFrame stays always on top even if you focus in another window: frame.setAlwaysOnTop(true); But what about the opposite of this? I need that the frame stays ...
Rikkin's user avatar
  • 509
1 vote
2 answers
1k views

How to fit a JTable to the size of JFrame?

I have a frame which is set to: setExtendedState(JFrame.MAXIMIZED_BOTH); Now I have a Jtable and on the Design phase of eclipse I have exactly fitted to the frame: But when I run the program I have ...
Bernard's user avatar
  • 4,320
0 votes
1 answer
1k views

frame.getContentPane().add(); not working properly?

I've been having some (very annoying) trouble with these scripts that I've created. Sburb.java import java.awt.Color; import javax.swing.*; public class Sburb { public static void main (String[] ...
terraform's user avatar
1 vote
0 answers
51 views

(Java) ideas on how to animate the cursor when it over a jbutton

Sorry for the lousy title. It's hard to describe my problem. I'm programming a user interface with jbuttons controlled with gaze. And I want the user to don't see the cursor moving around inside a ...
joaquin7's user avatar
-1 votes
1 answer
105 views

howto change the background color of a jframe

i have some code that creates a jframe but and changes the backgroun color but when i run it, it doesn't change the background color. The code is below. public static void main(String[] args) { ...
Andrew Neate's user avatar
0 votes
1 answer
645 views

What causes the Jframe to flicker while resizing?

public class AspectRatio extends JFrame implements ComponentListener{ public AspectRatio() { setSize(100, 100); setVisible(true); addComponentListener(this); } ...
user2891133's user avatar
-1 votes
2 answers
119 views

setBackground is undecorated JFrame

Okay.. I'm rewriting this question.. I've found out that setUndecorated() was not the problem. The problem was setBackground(new Color(0, 0, 0, 0) After some tries, the the CardLayout was showing ...
Hyun I Kim's user avatar
-1 votes
2 answers
91 views

Creating JFrame and getconentpane full-size

I am using Java, and trying to make my JFrame's size as the size of the window, not to overlap the taskbar. Off-course, I want it to be the exact same size at every screen resolution. Moreover, to ...
Alon Ben Natan's user avatar
1 vote
2 answers
480 views

JMenu appearing behind JFrame

I'm making a Java Applet in Eclipse IDE. I have a JMenu and a JFrame. The menu is appearing behind the JFrame for some reason.. like this: Here is where it is calling it: public Main() throws ...
user avatar
0 votes
2 answers
100 views

Maybe a good reason to use multiple JFrames, if not open to suggestions

I'm developing an application for a deposit ATM. Almost everyone has used one of these at least once in their life so it's safe to say you know what I'm talking about. I'm currently doing the GUI ...
isaric's user avatar
  • 195
0 votes
1 answer
1k views

Neither setContentPane() nor getContentPane().add() works

I can provide all of my code if that would aid in the problem, but I believe since this only affects one class really, it can be solved here, to simplify the issue. I have a solitaire project (mind ...
user avatar
0 votes
1 answer
71 views

Java JFrame Graphics dont show up

public class FrameTest extends JFrame { private JPanel contentPane; private JPanel spielPane; private JPanel infoPane; private JButton btnStart; private JLabel lblRunde; ...
Simon Schulz's user avatar
-1 votes
1 answer
1k views

how to align multiple jpanels under each other

in the below code i am trying to create tabs. 1-according to the code below, the jlabel the contains the word "Demo", at run time, it does not show up! why that is happening and how to force that ...
Amrmsmb's user avatar
0 votes
3 answers
69 views

Using an ActionListener to check for a specific instance from and then add to an ArrayList

I have created an GUI that accepts the following fields (name, street, city, state, zip, account number). In addition you are able to choose between 3 customer Types from a panel and finally a course ...
Aaron L. W- Gabriel's user avatar
0 votes
3 answers
347 views

Forcing JFrame to not resize after setResizable(false). Command wont work

I have a simple Atari breakout program, and long story short, one of my powerups is to allow the user to resize the window for a few seconds, then make the window non-resizable again.Everything works ...
Wonder132's user avatar
1 vote
2 answers
390 views

Java GUI Panels

I am trying to make a game for one of my classes, but I am running into trouble in implementing some of the things I want to do. Essentially, I want multiple different parts inside the same graphical ...
Zayne Kinkade's user avatar
0 votes
2 answers
4k views

Add 3 panels to a frame in java with JSplitPane?

Trying to add 3 panels i created to a frame in Java with the JSplitPane. Have tried this with 2 panels, and that worked great, but with 3 it still does not do what i want. Have read something about ...
Mikkel's user avatar
  • 1,791

1
93 94
95
96 97
200