Questions tagged [jframe]

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

Filter by
Sorted by
Tagged with
-4 votes
0 answers
62 views

Why won't my Java code show up correctly in BlueJ? [closed]

I'm on my first actual coding assignment and trying to create a short About Me page, but none of my code will show up. I'm not sure if it's a technical problem, because when I downloaded the initial ...
Kaydibee's user avatar
1 vote
1 answer
24 views

How do I make it so that my Jbuttons / Jpanels resizes with the JFrame?

I made this calculator program on Java and I wanted to add one more touch to it. What I want the program to do is to rezise the JButtons / JPanels with the JFrame. Meaning when a user stretches out ...
Sajal 's user avatar
  • 11
-1 votes
1 answer
31 views

Why do i receive a NullPointerExeption in my JFrame while using my array "messwerte" [duplicate]

import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing....
Kartoffelkopp's user avatar
0 votes
1 answer
18 views

New netbeans project outputs code but not jframe ui

I just created a new java project and opened a jframe file. When i added a few buttons and previewed it, it looks fine. But when i run the file (indexx.java) it shows me only the standard 'Hello World'...
Tnsae's user avatar
  • 1
1 vote
1 answer
39 views

Canvas render sometimes and doesn't render other times

It is not completely random, at some point in my code I create a matrix, the smaller the matrix, the higher the chances of the canvas rendering normally. Even if I completely remove the matrix it ...
Rafael Silva's user avatar
0 votes
1 answer
42 views

JPanel.getHeight() doesn't exactly work as intended

So I have a program that utilizes JFrame and JPanel and such. I have multiple JPanels with JTextAreas within them, like a list. I'm trying to create JScrollPane that allows me to scroll through all ...
ThrillerGriller's user avatar
0 votes
0 answers
31 views

{SOLVED} JFrame's repaint() functions doesn't seem to work?

I'm working on a JFrame application to save data with many different panels, labels and buttons. I want it so whenever data is added, it should refresh the page. It doesn't seem to work though? Here ...
ThrillerGriller's user avatar
0 votes
0 answers
34 views

Java Frame extract values of actionPerformed() to save it

I'm programming my first GUI in Java Language and I have found an problem/issue. This is my code: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import ...
Miguel Buitrago's user avatar
0 votes
0 answers
22 views

How to hide a JPanel in a JFrame then add another JPanel from other class [duplicate]

I have a basic JFrame that when the jButtonLogin is clicked, i want to hide the jPanelLogin , and add to jPanelPrincipal my panel PainelPrincipal , PainelPrincipal is a class that extends from JPanel ....
Matheus Isac's user avatar
0 votes
1 answer
56 views

Cant change content on a JPanel

I have a JFrame, which has a JPanel called gamePanel added to it. The game calls the method renderPlayerInfo multiple times after the main frame is set to visible. However, the panel does not change ...
Atomic Peanut's user avatar
0 votes
0 answers
6 views

JFrame wont appear when running program?

import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; // Java program to create a simple ...
Roberto Gonzales's user avatar
0 votes
0 answers
11 views

Switch between JPanels, that are in different classes, within a JFrame class, using JButtonsb (sorry) [duplicate]

i coded a game in java (the crome offline game but with my own textures). The the game screen incoded in a class that extends a jPanel and it is called by a different class that extends a jFrame. The ...
papa-jayy's user avatar
-2 votes
1 answer
69 views

StackOverFlow error keeps on propping up even without recursion in my code [closed]

I keep on seeing the "Exception in thread "main" java.lang.StackOverflowError". I know this mainly pops up because of recursion however in my code I don't see how its being ...
Nicholas McNamara's user avatar
0 votes
0 answers
15 views

can a JCheckbox be added to a JFrame?

I am new to programming, and I am wondering why I am getting an error when I try to add the checkBox oject to the JFrame object in the program: import javax.swing.*; public class MyCheckBoxExample ...
Ebrima mbye's user avatar
1 vote
0 answers
27 views

How to build Swing application with maven? [duplicate]

I'm trying to create simple java application, using IntelliJ Swing UI designer. To show my problem, i've created this sample project import javax.swing.*; import java.awt.*; public class GUIForm ...
Mike S's user avatar
  • 11
0 votes
1 answer
20 views

problems with JDateChooser

I just started my first complex java program, which is a bank system program. I want to check if the user is an adult or not. I added a JDateChooser to the frame, i can choose a date, but my ...
MsLaus's user avatar
  • 21
0 votes
0 answers
100 views

Application name is displayed as java instead of "my application" name in Mac-Sonoma beta version

Am using Java swing (Jframe) application, where it is showing java as its name in menu bar after upgrading to Sonoma beta 2 version how do I fix it, it’s a sample Jframe application used for testing....
Srinivas chowdary's user avatar
0 votes
0 answers
36 views

Java opening a new Jframe instantly so it appears without a delay

I am currently trying to open a new Jframe when a button is pressed and this is the easy part. But there is a slight delay opening the new Jframe. import java.awt.event.ActionEvent; import java.awt....
Jon doe's user avatar
  • 19
0 votes
0 answers
35 views

Image Icon won't appear

I am trying to add an Image Icon to my game so a logo appears when it is in the task bar. I get no errors when I run my code but the image won't appear. public class Game implements Runnable { ...
Stefan Cohn's user avatar
0 votes
2 answers
50 views

How do I force all Components in a JFrame to reacquire their Background property for light/dark mode purposes?

I am trying to write an application which, for UX purposes, I want the UI to have a light mode and a dark mode... as a result, I have two color variables, and I have a getForeground() and a ...
Shaun H's user avatar
1 vote
1 answer
14 views

how to place a JLabel in a Jframe that stays in the center even if you resize the jframe

when I open my program the buttons, fields and labels are statically positioned. when I expand the JFrame the buttons, fields etc. are positioned badly. of course I tried to place them manually. but ...
Exootic 's user avatar
0 votes
1 answer
31 views

Java - Multiple Panels in JFrame

I'm developing a hide and seek game for a school project, where two players move using the keyboard and if the hunter touches the survivor, the game is over. My initial approach is for each player to ...
Eduardo Rodrigues's user avatar
0 votes
0 answers
24 views

components only show after I resize the frame

My JLabel will not show immediately after I press the button until I resize the frame I think i have put frame.setVisible(true) in the right place I have looked at similar post and everyone has said ...
Ryan Guard's user avatar
0 votes
2 answers
40 views

close the JFrame using a button on jinternalframe

I am new to Java language.In my project i created a JInternalFrame inside a JDesktopPane that include in the JFrame(A). In that JInternalFrame i created a button that open another JFrame(B). So what i ...
Imalka Chandrasena's user avatar
1 vote
1 answer
77 views

How to use graphics 2d in kotlin with paint()

I want to start making a 2d video game, and I found a tutorial in java. However I wanted to use kotlin because I heard it is better, I am new to java and kotlin programming and I needed to put this ...
danny's user avatar
  • 37
1 vote
1 answer
45 views

Using JButton to change background color in JFrame with OOP

Im trying to learn to use Jframes in Java and i want to start easy. I wanted to make a JFrame with buttons that have different usage. The one button should change the background color of the frame but ...
Bootfahrer's user avatar
0 votes
1 answer
44 views

JSwing - Undecorated window not transparent despite being defined as transparent

I am trying to make this image appear on my screen, with the background being transparent, as a simple test for a bigger program (being a virtual pet) I am using the following code to do this: // Java ...
Slomas99's user avatar
0 votes
1 answer
40 views

How to close second window without closing entire sketch in Processing?

I'm working on a prototype for software for my work. I've managed through examples and tutorials to create a second window for additional options which is great. Except for the fact that closing that ...
ColtTheNark's user avatar
-1 votes
1 answer
39 views

JFrame window doesn't appear

My code below is creating a JFrame window with basic components, I was running to test but the window doesn't show up. I'm working on Eclipse. package B3; import javax.swing.*; import java.awt.*; ...
Khoa Phạm's user avatar
0 votes
0 answers
17 views

How can I paint an object and make it stay through if statements. I have tried creating a boolean but don't know how to keep it true

Main Class import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class Main extends JPanel { RocketLaunch r = new RocketLaunch(0,0,...
Sharar294's user avatar
0 votes
0 answers
30 views

How do i implement the JPanel and JLabels of one class in another to the frame

Im currentl programming a pacman style game and i`m doing the gui right now. My Plan is to write seperate Gui classes and in this example i wrote the Gui for my Hearts. My plan is to combine all the ...
Resos82010's user avatar
0 votes
0 answers
18 views

Try to add Taskbar Icon

1 image 2 image private void displayTaskbarIcon() { IEC iec = new IEC(); StringBuffer installPathBuffer = new StringBuffer(); installPathBuffer.append(iec.recoverIEFPath()...
Anjali Yadav's user avatar
0 votes
0 answers
11 views

Cannot invoke "java.net.URL.toExternalForm()" because "location" is null [duplicate]

I am working on a personal project for fun and trying to load images onto JFrame using ImageIcon. I'm getting the error: Cannot invoke "java.net.URL.toExternalForm()" because "location&...
stephan's user avatar
0 votes
0 answers
15 views

Painting a JTextField while using Graphics2D

I am trying to do a simple calculator and I've decided to use Graphics2D. I have no trouble painting some Jlabels, but when I try to paint a JTextField, everything on the JFrame disappeared and only a ...
b0b4u's user avatar
  • 1
0 votes
0 answers
14 views

How to change the background colour of the inside of a JComboBox

I am creating a small java game for a school project. I am using some components of JFrame; JPanels, JLabels, JComboBoxs. Image of my JComboBox: I want to change the blue-ish colour of the JComboBox ...
Nana De Banana's user avatar
0 votes
0 answers
30 views

How to get Multiple value of actionListener of one frame to another farme in java?

I want a value of String name ,father name etc from actionListener of one frame to another frame so that i can make pdf of output values. so how can i do that? i tried by inheritance & ...
Hamza Anjum's user avatar
0 votes
1 answer
42 views

I've assigned another class that draws images to a JPanel in the main JFrame, but it doesn't work

I tried to create a JPanel and apply graphics to it, but only a blank screen appears. I created a new class that extends JPanel and assigned it to an arbitrary panel in the main JFrame. (inGamePanel ...
Epee's user avatar
  • 3
0 votes
0 answers
28 views

ActionListener and ActionEvent not working - trying to click JButtons

I am really new to Java, so this is probably an easy fix, but I'm trying to make a button clear the screen when it is pressed for a civil-war based game for a school project This is my code that s ...
JACK SUMMERS's user avatar
-1 votes
1 answer
29 views

Java Swing: BufferedImage is a different scale to JFrame despite the same input resolution

I am trying to make an editable grid of pixels using a Java BufferedImage in a JFrame. I set the size of the JFrame and the BufferedImage to be the same: int width = 640; int height = 480; PixelGrid ...
Slomas99's user avatar
0 votes
0 answers
27 views

Resizing application window with JFrame and JPanel creates black space and tears, sometimes does not fit frame to panel properly

Resizing application window creates black space and tears. I am a beginner programmer trying to create a simple chessboard that scales appropriately when you drag the borders of the window to resize. ...
Emre Tekmen's user avatar
0 votes
0 answers
25 views

problem with adding an image on a JFrame with a label

so I have an image in the folder of my project and I want to upload it on a label in a JFrame so the image will be show in the user interface, but when I run the project I only get the grey screen the ...
nohjilk vanderlust's user avatar
0 votes
0 answers
30 views

Tried replacing a temp file by renaming to my original file name.. But it's not working?

Ok, I tried to rename my temp file to ori file name. However no matter what I tried. The temp file won't rename to my ori file name. My code: `public class delete { public void deleteLines(...
Eruri's user avatar
  • 21
0 votes
1 answer
77 views

SetIcon gives symbol error in Java when I want to set icon of label

I am trying to Add an Image into jFrame with a label. I saw on multiple website you should import javax.swing.ImageIcon, create a ImageIcon object and set the icon of the label as the object. When I ...
Lemonexe's user avatar
0 votes
2 answers
65 views

can't resize and set location of JFrame in the same time

I was trying to do some projects for traning, in this one I added an undecorated JFrame, so I added MouseMotionListener to it to change the mouse cursor then change it's size and location to look like ...
tans flou's user avatar
1 vote
1 answer
78 views

How to create different windows on Java GUI? [closed]

So I have created a game and I'm just finishing up the project now but then at then end I realised I need to have a home screen where the player has the option to press start button or settings. My ...
User's user avatar
  • 41
0 votes
0 answers
16 views

Question about JPanel cover the whole area of BorderLayout when using BorderLayout.CENTER

I am trying to set a BorderLayout of my JFrame. Firstly create a FlowLayout with two JButtons. Then add the FlowLayout the top of BorderLayout. It works correctly according to my code. Secondly, I ...
catlover's user avatar
-3 votes
1 answer
27 views

Java - GridBagLayout wrong ratio

I am new to creating a GUI with Java. I tried to use the GridBagLayout for a project but i am stuck here. I want to make the Button and the two JLabels the same size but the button is bigger. public ...
etzetera's user avatar
0 votes
1 answer
27 views

Display and then close a frame in Java

Here the code: public class attrape_ball { JFrame frame = new JFrame(); JPanel attrape = new JPanel(); public attrape_ball(pokeball pk) { JLabel ramasseball = new JLabel("...
Thibaud Zobel's user avatar
0 votes
0 answers
878 views

java.util.ArrayList is in module java.base of loader 'bootstrap'; model.servicecls is in unnamed module of loader 'app'

I'm developing an object-oriented Netbeans application. My J Internal Frame is giving a problem that says: class java.util.ArrayList cannot be cast to class model.servicecls (java.util.ArrayList is ...
brithy carvajal's user avatar
-2 votes
1 answer
27 views

How to add mutiple JLabel's inside JFrame [duplicate]

I'm having trouble adding my other JLabels and JTextFields in the JFrame. In my code I am trying to calculate the area of a triangle and want the user to add in the numbers for the sides. I have ...
chriscondreay's user avatar

1
2 3 4 5
200