Questions tagged [null-layout-manager]

236 questions
1
vote
1 answer

JScrollPane on dynamic filled JPanel with null layout

i want a scrollpane on my GUI. The area, i want to have "scrollable" is a JPanel without any LayoutManager, because the content is something between static and dynamic... but maybe a part of my code will help Here it is: pane = getContentPane(); …
1
vote
3 answers

How do I add a scroll bar in a null layout?

I have been trying to get a scroll bar on my JTextArea for days, I've tried every way to do it as I could find. I am making a Chat Client and I have the JPanel setup with a null layout. I've tried using the Layout Managers but I don't understand how…
1
vote
1 answer

How does JButton control it's size?

I have added a button to a frame and controlling it's text and/or minimum size with timer. I noticed, that button does grow sometimes, and sometimes does not. If in null layout, then it ignores both text and minimum width changing. If in FlowLayout…
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
1
vote
4 answers

How to position something on a certain point on a JPanel?

Right now I have the following code which adds the JLabel to the top center of the Panel, which I assume is the default imageLabel = new JLabel(); ImageIcon customer1 = new ImageIcon("src/view/images/crab.png"); …
1
vote
3 answers

Outer class jframe is not hiding when calling the inner class jframe

When i am calling the inner jframe, it is called, but outer jframe is not hiding. instead it gets overlapped. so what will be the solution for this. Is there any way to get out of this. As i tried when i am calling the inner class frame, the outer…
Shubhro
  • 73
  • 2
  • 11
1
vote
2 answers

java JScrollPane with JPanel with BoxLayout resizes elements

I have a collection of JPanels for different elements: JPanel showPane, seasonsPane, episodesPane, airingsPane all of which have setLayout set to null and are of fixed size 304x416. I added those JPanels to a JPanel called showViewPanel of size…
KG6ZVP
  • 3,610
  • 4
  • 26
  • 45
1
vote
1 answer

Button expanding with no layout

I'm working on a GUI and i decided that I want to build the GUI with no layout. Instead, I'm using the setBounds() function. When I'm placing only one button it's all work fine, but when i place the other button, he's expanding and fills the hole…
user2129468
  • 681
  • 3
  • 8
  • 12
1
vote
1 answer

Why JButton and JTextField show after I maximize the windows?

I try to make calculator with Netbeans. But the component of calculator does not show until I maximize the window. Why? This is the source code: import java.awt.*; import java.awt.event.*; import javax.swing.*; class Kalkulator extends JFrame…
1
vote
3 answers

JLayeredPane not respecting layers

I have a JLayeredPane. My program works something like this: JPanel p1 = new JPanel(new BoxLayout(p1, BoxLayout.X_AXIS)); JPanel p2 = new JPanel(new BoxLayout(p2, BoxLayout.Y_AXIS)); JLayeredPane lp = new JLayeredPane(); lp.add(p1, 1); lp.add(p2,…
ThePrince
  • 818
  • 2
  • 12
  • 26
1
vote
1 answer

JLayeredPane, background image + "icon" layer

I need 2 separate JPanels (or any lightweight components) on top of each-other and ultimately embedded within a JPanel, either directly or through something like a JLayeredPane. Thus, no heavy-weight components or glass pane. The lower JPanel (named…
Jason
  • 2,579
  • 1
  • 17
  • 19
1
vote
3 answers

JPanel didn't show rest of it's component

I have frame with a button and a JPanel as I named panel, I want after I clicked the button add an inner panel to my panel. But this but there is a problem with this! because after adding second panel it didn't add any other panel. Code import…
Lrrr
  • 4,755
  • 5
  • 41
  • 63
1
vote
2 answers

JScrollBar Doesn't Do Anything

I'm trying to put a vertical JScrollBar on top of a JPanel. I can add the scoll bar easily enough, but when I run the program, my scroll bar doesn't have any effect. I can drag it up and down, but the contents of the JPanel don't move. I've read all…
AndroidDev
  • 20,466
  • 42
  • 148
  • 239
1
vote
1 answer

How to set the size of a panel inside a panel with null layout?

I have a main panel using a null layout and I want to add three more panel in it but I want those three panels to automatically resize upon loading of the main panel. I cant use layout managers since I will be dragging those three panels. I tried…
John
  • 836
  • 2
  • 25
  • 39
0
votes
2 answers

How do I make a JLabel always stay above a JButton?

So I have a gui where the layout is set to Null, and I put JLabels ontop of JButtons since the JButtons have icons and adding text to the button makes the button look distorted, so instead I am using JLabels ontop of the JButtons. Every time the…
jocopa3
  • 796
  • 1
  • 10
  • 29
0
votes
2 answers

Painting in Swing

I have a class (Timeline) which extends JPanel. The Timeline Panel contains many JLabels (green and orange elements) which are positioned manually ("null-Layout"). On top of the Timeline are some buttons for switching between months. Sometimes when…
endian
  • 4,761
  • 7
  • 32
  • 54