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.

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.

Resources:

7557 questions
2
votes
2 answers

Fail to reset the panel to initial state

I have problem with the Play Again button, which is to reset the panel to initial state. The Play Again button should reset the panel, it does reshuffle the gameList, but not reset the panel, which means all the buttons remain and lost the…
Chin
  • 593
  • 4
  • 15
  • 36
2
votes
2 answers

jPanel is not refreshing until I resize the app window

I have one problem with my jPanel. I have a button which PNG image from String input (math formula) and then it will repaint the old image in jPanel. And there goes the problem. The image got changed, but the jPanel wont repaint until I manually…
cMe
  • 23
  • 1
  • 4
2
votes
1 answer

How to stop JProgressBar on parent?

I am working on an application where I am using JprogressBar, When I am doing something then progress bar is running. I also added escape functionality there. when anyone click on Escape button of keyboard then focused Jpanel/Jdialog/JFrame is …
Ronak Jain
  • 2,402
  • 2
  • 24
  • 38
2
votes
2 answers

Java Swing - make two JLists "siblings" - i.e. only one item in either can be selected

I have a JPanel which contains two JLists - both can have an item in them selected - as expected. What I'd love to be able to do is have it so that only one item in either to be selected Can anyone help me with either a) "marrying" them so this…
2
votes
2 answers

Resizing images and JPanel on JFrame when JFrame get resized

I have made a jframe which contain three jpanel ,these three panel devides the jframe into three equal parts. each panel contain an image.I want to resize the images and panel when frame get resizes from heigher to lower size.Can anybody tell how…
Rash1100
  • 21
  • 1
  • 2
2
votes
2 answers

swing - get component clicked on JPanel

OK so I've got a JPanel with a GridLayout. Each cell of the grid then contains another JPanel. What I'd like to be able to do is have a listener on the "underneath" JPanel which then tells me which of the "overlayed" JPanels was clicked - so I can…
2
votes
2 answers

Cannot add multiple JPanel in JFrame,

I have a following JFrame. public class AddActivityWindow extends JFrame { //declaration of components go here ... public AddActivityWindow(ActivityStore store) { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel…
Ankit
  • 6,772
  • 11
  • 48
  • 84
2
votes
1 answer

Image not repainting, just multiplying

I have a JPanel implements a key listener. It pulls and displays an Image pulled from another class. NA the Key listener is passed to that class to get one of many images and move it 2px in a direction. My problem is that the old image does not…
user1376339
  • 313
  • 1
  • 2
  • 10
2
votes
2 answers

JPanel notified by LayoutManager when resized

I have a class MyPanel that extends JPanel. MyPanel is a child panel: his size is dinamically calculated by the LayoutManager of his parent. The problem is that I need MyPanel to be notified as soon as the LayoutManager of his parent calculates his…
Oneiros
  • 4,328
  • 6
  • 40
  • 69
2
votes
4 answers

Canvas vs. Panel

If I want to display ellipses and rectangles on a screen, should I use a canvas or a JPanel? What is the difference? When do I use each?
Anonymous181
  • 1,863
  • 6
  • 24
  • 27
2
votes
4 answers

Repainting JPanel after button click

I'm new in Java Swing and I have a strange problem to refresh my JPanel. I create a static JPanel componant in my frame and I call a static method from a FileListenner to repaint my JPanel public static void repaintPlan(JPanel f) { …
Anass
  • 6,132
  • 6
  • 27
  • 35
2
votes
2 answers

In Java, how do I add a JLabel to a rectangle?

I'm trying to add a JLabel onto my health bar that is a simulated by a green rectangle on top of a red rectangle. Although I declare a JLabel and attach it to my rectangleComponent, it never shows up. Any ideas? Here's my rectangleComponent and the…
keyert
  • 255
  • 1
  • 4
  • 12
2
votes
2 answers

how to make closing JPanel trigger a method

I got an example of JPanel from the Oracle tutorials I see it uses a default method to close the window frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); what I want is the act of closing the window when clicking the close button, to trigger…
John smith
  • 27
  • 1
  • 1
  • 5
2
votes
2 answers

Adding/Removing Lines from a JPanel

I am trying to create a graph implementation where the graph is displayed on a JPanel. I am adding and removing vertices without a problem (I am using more panels for these). The problem I am having is adding lines to represent the edges. I know I…
KristenApril
  • 263
  • 1
  • 3
  • 6
2
votes
1 answer

Referencing coordinates of a JPanel in a JFrame

Hi I am having trouble with referencing the origin of a JPanel within my JFrame. My JPanel was set up like so in the constructor I want to add a line that is on the left edge of my JPanel. table = new JPanel(); …
Yoshi
  • 115
  • 11