Skip to content
Advertisement

Tag: swing

How to make all images in Grid Overlay flush?

I am trying to implement a GUI for a maze-based game I created that meets the following specific conditions: The GUI itself has a set size and is not resizable (line 41) . The master panel (line 57) that contains all the maze images is scrollable. All maze image components are flush with each other. If maze is small enough,

How can I add a scroll bar to a text area?

Please, anyone, tell me how to add the scrollbar to a JTextArea. I tried out many things. but still not able to get it. I copied some codes related to the text area. Answer Oracle has a helpful tutorial, Creating a GUI With Swing. Skip the Netbeans section. As Andrew said, you have to place the JTextArea inside of a

Have keyevent listener method constantly checking input

I wrote this method: It is the method of a class extending JTextArea (yes, I know extending is suboptimal but I won’t need anything else for the intended application, at least not to my knowledge). It is supposed to check every character being entered into the JTextArea and send the message (the settext part) if the key being pressed is

Swing: can’t paint rectangle

I have this simple code: the JFrame adds custom Jpanel MyPanel which overrides paintComponent method to draw the rectangle. However nothing shows up on the window: Answer By default, an empty JPanel has a size of 0x0, so when you add it to your UI, the layout manager (in this case) honours it’s request and makes it 0x0 Start by

Is there a way to hide all elements in JFrame

I’m currently working on Java application and I’m using JFrame and inside of JFrame i have some buttons, labels and textfields. I’m in need of hiding all the elements that are in JFrame. I don’t need to hide JFrame itself, only the elements in it so I can display some others. Is there a way to hide them all without

Cant add to arraylist inside actionevent Buttonclicked

Im kind of new to programming in java but here im trying to figure out how to add the value of a button clicked in ActionEvent. I even changed the actionlistener to MouseListener etc but still not working. It only displays the current button clicked but i would like to add every button clicked into an arraylist. Problem: I cant

Java Swing – Show multiple panels

I’m using the Java Swing UI Designer in IntelliJ 🙁 I designed something in the designer using multiple panels and spacers with 1 parent panel. When I add the main panel, the first one inside it shows, but the others don’t. Frame structure: Panel1 GradientPanel Panel Spacers What I designed What I get Answer First you need to know that

Advertisement