I have a JFrame that I want to add a menu bar to and then have that JFrame automatically open in fullscreen. If I just make a JFrame and set it to fullscreen with f.setExtendedState(f.getExtendedState()|JFrame.MAXIMIZED_BOTH ); that works fine: However, once I add a JMenuBar to that JFrame it will no longer o…
Tag: swing
How can I make a checkbox on JTable not editable after a checkbox is clicked?
I have created a JTable with 4 columns, the last two columns are JCheckBoxes. I would like to disable the checkbox in column three after I clicked the checkbox on column two and vice versa. This is what I’ve done so far but both column 2 and 3 are editable. Please help. Thank you. Answer but both column…
JTable becomes blank after executing update on table? [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I am …
How to get text from same Text Field used multiple times in Java Swing
I’m trying to get text from a JTextField iterated through my code (apparently, I can’t add a different text field from a button). Here’s what the “Add Items” button do: It adds two new text fields in the panel using FlowLayout. Now, I want to get the text given by the user from t…
Why don’t size and preferredSize make this label bigger?
I’m building up a panel that will go in a larger program; the following program still illustrates my question, but it looks a bit more complicated than it absolutely has to because there are places I will add things later. I would like the currentImageLabel to be a standard size; I intend for it to get …
Java Swing JButton alignment – BoxLayout
Below is a small example where two radio buttons are offset too far to the left column. However, if I remove the “A” button above by commenting out this code: Then the 2 radio buttons are displayed as expected and not offset: How do I get the radio buttons aligned correctly like the second case, b…
Java paint line in existing JPanel with components
I’ve been searching for a few hours, including at other questions on stack such as. I need simplest way to draw a line in java in AWT panel but couldn’t find my answer. I have a panel gridbaglayout with multiple dynamically generated components. The class extends JFrame and thus can’t extend…
How to get rid of text outline on JButton
I’m making a program which includes JButtons with the text “+” and “-” on them. Why does the JButton have an outline around the text within? How do I get rid of the square around …
In the Eclipse WindowBuilder editor, the Design tab isn’t showing anything
When I create a jframe within a java project it shows me all the code in the Source part but when I go to Design it shows nothing? Would like some help on how to get the whole interface where you customise the GUI. Answer That’s a known issue of the Eclipse 2020-09 release which is already fixed (see Ec…
Java Swing unable to remove a component
I am trying to build a quiz game that rerender itself after user click on the button with answer. I have added an action listener to 4 buttons. When the button is clicked, it is suppose to reach the outer class which extend JFrame and remove the QuestionPanel that extends the JPanel. And then create a new Que…