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 …
Tag: jpanel
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 kept of the person’s scores. The game is run from a base GUI JFrame, and I want
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 change it into JLabel.The syntax is correct, but the Jlabels do not show. I tried cleaning my paint method and It started
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 have tried running the program but I’m still unable to display anything, I move the slider but nothing appears on screen. I have tried coding
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 do i write a code to display every letter in every JPanel, and how do I rotate. (JFrame, NetBeans)
I’m new to Java, and I was assigned in my class to develop a code for the following question, I was only able to do the design, after that I didn’t know how to continue adding the actions to every button. This is the question: https://www.chegg.com/homework-help/questions-and-answers/write-java-application-creates-frame-similar-one-shown–four-letter-word-shown-four-panels-q52352988 If anyone has ever solved it, please share it. Thanks for help in advance!
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
How do I stop JFrame/JPanel from auto-formatting the distances between my components?
So I’m writing a program which utilizes a GUI. The GUI is built from a JFrame and a JPanel in Java. I have a JTextArea() and a JButton() that appears beside the JTextArea on the left. I also have an image which I imported locally using the method call below (“f” is the variable name of my JFrame): I don’t
JPanel takes the entire space of JFrame
I am struggling to place some simple objects using the FlowLayout manager in Swing. Basically I have created a small program, I have set up the size of the frame, then crated some JLabels and then one JPanel. I have put the JPanel a setSize of 300×300 and changed it’s color to red to visually see it. However it takes