Skip to main content

All Questions

Tagged with
0 votes
1 answer
34 views

My components in two different panels are too small and don't fit to the frames size, how can I fix this?

I made a JFrame (size: 500 , 600) that uses GridBagLayout to place two JPanels (one using GridLayout and the other using GridBagLayout) on top of each other; however, when I run my JFrame the ...
user25673196's user avatar
0 votes
2 answers
48 views

Java GridBagLayout does not fully display the JButtons

I have a JPanel with one JLabel, two JButtons and a GridBagLayout as the layout manager. The problem that I now have is that when I add all the components to the panel (using the GridBagConstraints of ...
NoNameIdea's user avatar
0 votes
1 answer
45 views

Changing JLabel text changes distribution of space by GridBagLayout

I have a JFrame with GridBagLayout, which contains a JLabel and a JScrollPane. The JScrollPane contains a ScrollablePanel, which in turn contains a certain amount of DebugComponents. The ...
hinrich.'s user avatar
-1 votes
1 answer
33 views

Image Overflows Allocated Space in JPanel: Seeking Assistance

I would need your help again. When, in the following code, I try to add an image to the JPanel, it completely ignores the space allocated by GridBagLayout and GridBagConstraints. Indeed, the image ...
Matthys's user avatar
0 votes
1 answer
35 views

Ensuring Responsive Text Size in Java Graphical Interface with Custom Buttons

I would need help with a Java project, specifically regarding the graphical part. I have created a graphical object called RButton that allows me to create custom buttons. I display them on a grid ...
Matthys's user avatar
0 votes
2 answers
56 views

Why is the JButton is not taking up the whole screen?

I just started using Java Swing and GridBagLayout, and I can't figure out how to get the button to take up all of the space I'm trying to give it (the whole window in this case). I apologize if my ...
jframeOptimist's user avatar
1 vote
1 answer
24 views

GridBagLayout component size is dependent on JFrame size

I have the following program (simplified version of my actual program): MyPanel.java: public class MyPanel extends JPanel{ private JLayeredPane layeredPane; public MyPanel(int width, int ...
B3NII's user avatar
  • 405
1 vote
1 answer
32 views

Having problem when using GridBagLayout on JPanel and putting JButton inside

Here's what I've got. I have two JPanels, each with GridBagLayout. They have weightx = 0.5 and fill both directions. So basically the window is half one JPanel, half the other. And it should stay this ...
MouseTheMilkLover's user avatar
0 votes
1 answer
108 views

Struggling to create an uneven grid in Swing

I have a working application that uses GridLayout to make a 2 by 2 grid, each containing a JPanel. The GridLayout worked just fine, I just did mainPanel.setLayout(new GridLayout(2, 2)), and everything ...
davidalayachew's user avatar
0 votes
0 answers
45 views

How to fix component size in GridBagLayout for java swing

I have been working on making a GUI interface for a game im working on. I decided to use java swing because it's just built into the language and there are a lot of tutorials online. Here is the ...
user21749640's user avatar
-1 votes
2 answers
74 views

How does java swing fix the percentage size of the JTextArea so that it doesn't change?

I am developing a GUI interface using Java Swing's GridBagLayout, in which I use JTextArea, which I set to 40% on the left side after adding it to the JScrollPane, and a JList on the right side after ...
apython's user avatar
  • 23
0 votes
1 answer
36 views

Change Insets when changing screen size with Grid Bag Constraints

I have a program intended to be a start menu for a game. So far I have 3 JPanels: homePanel, mainPanel and optionsPanel. The 'homePanel' is a panel holding both menu and options panel. mainPanel has ...
Semlan Bakelsen's user avatar
0 votes
1 answer
42 views

Layout Manager assistance

I'm trying to make a collapsible panel look and having some issue with the layout manager, I'm pretty new at using layout managers and trying to userstand them. I have Jpanel with a flowlayout, I'm ...
user1547386's user avatar
0 votes
1 answer
59 views

Cannot add padding to JPanel (GridBagLayout), with 2 other JPanels inside

are you able to help me understand why there is no padding in dataInputPanel (the red border one)? Goal: To have 10 padding on top, right, bottom, left in dataInputPanel Error: No errors. It's just ...
OrlandoVSilva's user avatar
0 votes
1 answer
54 views

GridBagLayout: Why is my femaleRadioButton can't be visible?

I used GridBagLayout to build a frame for my Swing Student form. This is my code: package layout; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Student extends ...
Phú Huỳnh Gia's user avatar

15 30 50 per page
1
2 3 4 5
71