Join us in building a kind, collaborative learning community via our updatedCode of Conduct.

Questions tagged [jpanel]

JPanel is a container in the Java Swing Framework that allows custom rendering using layout managers. JPanels can be nested for flexibility. There is also a jQuery plugin with the same name that provides accordions, tabs, and fieldsets from simple container mark up.

-2
votes
0answers
29 views

How to make a JLabel show “…” instead of extending when the text is too long

I am displaying data in a JFrame using GridLayout, however whenever the text is too long it extends all the JLabels and stretches them off screen. I don't want to have a horizontal scroll bar, I want ...
0
votes
0answers
28 views

How can I center components automatically in a jPanel? [on hold]

I have various textfields, buttons and labels, and I have a button and checkboxes that set those components visible and not visible to the user's will.What can I do in order to make the components ...
0
votes
1answer
28 views

How to override background color for disabled JPanel

In Java Swing application, I am using nimbus look and feel.I try to override JPanel background color (enabled or disabled) without success.Doc oracle, Nimbus Defaults -> Search "Panel.background"....
0
votes
0answers
16 views

Adding a class that extends Canvas to a JPanel doesn't work [duplicate]

I know that there are similar questions on SO like here, but none of them have seemed to fix my problem.So far, I have two classes: a Game class that extends Canvas, and a Window class. All the ...
0
votes
1answer
40 views

Making Table With List Of JPanels

I need to a table in Java application. First I used to a Object of class JTable but my table has a lot of features and at now I try to use a list of JPanel components instead a table.How can I make ...
0
votes
0answers
5 views

method for displaying a object in the center of a MAXIMIZED_BOTH on the JFrame

I am currently trying to display a object that has a js file behind it on the jframe and the jframe has the setExtendedState(JFrame.MAXIMIZED_BOTH) put on to it, which is the best method to display ...
-4
votes
0answers
12 views

How to open a new class App by clicking on the button?

To start, i really would like to know the difference between: public void actionPerformed(java.awt.event.ActionEvent e) ` public void actionPerformed(ActionEvent e)`I'm asking this question ...
0
votes
0answers
5 views

Retrieving input from a user when working with components of a jframe

I have created a basic template of a form that I would like my user to fill out. However, whenever I run the program and try to input information, when I print out what the was inputted I just get an ...
0
votes
0answers
7 views

Java - JPanel outside borders of JPanel, how to see all

I'm adding JPanel inside my own map that is made of a JPanel.Sometimes my map is so widespread that some JPanels are outside the borders of map. I want it to keep the same size, so how do use ...
0
votes
1answer
26 views

How to clear jPanel before next drawing

I've searched up online and there are supposedly many ways to clear a jPanel before starting a new drawing however, after trying all I still have no success - the outcomes are either the panel doesn't ...
0
votes
0answers
14 views

JPanel disappearing when moved on specific Tile in GridBagLayout

I have a JLayeredPane laid out with a GridBagLayout in which another JPanel is moving on user's key input. Everything works fine, the panel (called dot) moves fine, but on the last Tile of the Grid (...
0
votes
0answers
8 views

How to make 2 JPanels scroll at the same time?

I am displaying a table in a scrollable JPanel, and I also have a JPanel with the column titles that are also buttons to sort by the columns. I do this so the titles stay fixed while you scroll down ...
0
votes
1answer
27 views

BoxLayout can't be shared error, trying to fit two JPanels in a JFrame [duplicate]

Trying to have 2 panels in a frame, one small one at the top and one filling up the rest of the frame. This code returns a "BoxLayout can't be shared" error though.JFrame frame=new JFrame("...
0
votes
1answer
19 views

Switching contentpane in real time

I try to make java small project with intro and after full video or keypressed skip to menu. I made enums for state of "game". How i can switch JPanels and stop everything that old one is doing, ...
1
vote
1answer
22 views

g argument in paintComponent(Graphics g)

I am beginner in java. I encounter method paintComponent() in a book and the book says system calls the method when it need to be called.My question is what is the g argument ?Is it the object of ...
0
votes
0answers
9 views

Trying to cast a panel to JOptionPane

I am trying to cast a Panel into a JOptionPane information message, the panel will eventually contain multiple images depending on the rolls of two dice. I am trying to get the image of the dice to ...
0
votes
1answer
13 views

MouseListener for a custom circle object is not working when it is drawn to a JPanel Gameboard object

I am developing the peg game in java, and I have been stuck on getting a hole to change color when it is clicked on to indicate that it has been selected. I currently have 3 classes, all of which ...
0
votes
1answer
49 views

jFrame with jPanel

Bonjour, i'm actually trying to switch from a jPanel to another one in my jFrame.i have change my code and here is what it look likei have followed this :How to use CardLayout with Netbeans GUI ...
0
votes
0answers
12 views

KeyListener not responding after pressing it for a while

My goal is to be able to control an ImageIcon with the keyboard, and I did it.However, the problem is that after I press keys on my Mac Pro a few times, the key will stop working. I don't know if it ...
0
votes
0answers
14 views

NPE when adding a JButton on my interface [duplicate]

I am working to build an age calculator using a GUI. It runs fine until I try to implement my ActionListner Inner class. If I block out the inner class and my add.button command it runs fine. As ...
-1
votes
0answers
17 views

How can I make a list dynamically change a panel or a JTable?

https://imgur.com/a/GxouB0a "This"Hello, I am trying to make a system where I can select different classes from a list and the register changes accordingly. I tried to re-initialise the table when ...
-2
votes
0answers
16 views

getContentPane() cannot find symbol [duplicate]

/** To change this license header, choose License Headers in Project Properties.* To change this template file, choose Tools | Templates* and open the template in the editor.*/package ...
-1
votes
0answers
17 views

I't is more advisable using Jpanel with label and icon as button than using jbutton with label and icon?

I'm a new to java..i've seen a lot of tutorial using jpanel with icons and label as clickable button it is better to use it than creating jbutton with icons and label?
0
votes
0answers
15 views

Java - Changing visibility between multiple panels

I have two different components I want to be able to switch visibility of. They both work and become visbile if no other JPanel/JScrollPane is occupying the space, but when I call the second ...
-2
votes
1answer
28 views

Layout Issue In Java

I am making a project in java and I am trying to set the layout of the JPanel That I Have created when I create It, I don`t really know what is causing this issue of it being underlined red.I am ...
0
votes
1answer
26 views

JCheckBox components doesn't show on JPanel after re adding them

i am trying to make a JCheckBox list inside a JScrollPanel which is contained in a JDialogBox.Here is my code:public void initTableChoices(DatabaseInit db){checkList=new ArrayList<>();...
0
votes
2answers
36 views

Panel in Java Swing float left with vertical bars

How I can create a JPanel with a lot of buttons aligned float left and with vertical scrollbars only?The buttons should be sorted like below.1 2 3 45 6 7 89 10 11 12
0
votes
0answers
6 views

how to do Absolute Positioning for JLabel

Im having trouble positioning a JLabel freely amongst my JFrame please explain how this is done or what the error is.import java.awt.*;import java.awt.peer.FileDialogPeer;import java.io.File;...
3
votes
3answers
43 views

Add JButton array to a JPanel (buttons not visible)

I'm trying to create a simple calculator with Java. For that purpose I created an array of JButton and added them to the JPanel.The issue: the buttons are not visible.I also added a single JLabel ...
0
votes
0answers
32 views

Java - how do I emulate StdIn programmatically when repainting a jframe

The client has requested a Graphical Interface for their currently command-line driven program. (The program animates a flowchart in a separate window.) The commands activate loops which repaint the ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,