I want to add a Pie chart inside a JPanel. I have gone through this and this. But it didnt helped me. I tried this code in the debugger but it is not getting pass line X. Somehow setScene function is …
Tag: jpanel
How do I put two Jpanels/Jbuttons in the borderlayout north section?
How do I display two JPanels in the ‘North’ in borderlayout? Here’s and example code that outputs a GUI with three distinct rows, Top, Middle, Bottom. There’s one button covering the first row, 3 buttons covering the second row, and one covering the bottom row. Output of above code: output of above code However, I’d like there to be two
JComponent not being drawn on JLayeredPane, JPanel is
I’ve added a JLayeredPane to a JFrame. To said pane i’ve added a JComponent with overloaded paintComponent(Graphics g) method, which calls super.paintComponent(g) among other things. The JComponent …
Enable a JButton when some component changed its border color [closed]
My goal is to enable a JButton only when some JTextFields and JComboBox change its border color from red to green. These components are included in three different JPanel. I try to create a function …
How can I set up a JFrame button to open another JFrame, and then receive information once the second jframe is closed?
This is part of a project for school, and I’m stuck and need someone to bounce ideas off of. I have a game where there is an option to sign up or sign in for a machine-local game so a record can be …
My JPanel doesn’t show after adding the paint method
I recently created my first board for my first board game and draw the board multiple ways on my JPanel.I finally decided to use Label, but since I needed to add pictures to that label, I had to …
How can you draw rectangles on a JPanel?
I’m trying to create a program that generates rectangles using a slider. The user should be able to move the slider and rectangles should appear on the JPanel above the slider with random positions. I …
Can I acces variables and/or methods of the class a JFrame was created in from the panel?
shortened code: Is it possible to directly access obj from panel? If yes: How? Thank you in advance for your help. 🙂 Answer No; Not without passing the reference to object to the panel.
How to add a JPanel graphic to a JFrame without covering the JFrame
I’m trying to add a small tornado graphic (upside down pyramid) to my Frame. I can get the tornado by adding it to the frame in the main method but when I do that all I see is the tornado graphic and not the GUI underneath it. So, I’m now trying to add the Tornado graphic to the frame when
How to scale basic drawings?
I would like to have a list of shapes, that appears in my window. Whenever I’m changing the size of the window, I would like to scale all of my drawings. I already prepared classes, that store information about random shapes in a list (rectangles, ovals, etc.). I have no problem with painting them all, but I can’t deal with