Questions tagged [null-layout-manager]

236 questions
3
votes
2 answers

Responsive JFrame without Layout Manager

I am trying to do have two button in JFrame, and I call the setBounds method of them for setting the positions and size of them and also I passed null to setLayout1 because I want to usesetBounds` method of component. Now I want to do something with…
Elyas Hadizadeh
  • 3,289
  • 8
  • 40
  • 54
3
votes
1 answer

Put a JTextfield on a JPanel?

Why the textfield is not appearing on my panel which is inside my frame? I mean is there some additional action necessary to make the components of the panel visible? I hope somebody can help me.... public class example1 { public static void…
user3133542
  • 1,695
  • 4
  • 21
  • 42
3
votes
1 answer

Java GUI button's label can't be seen

I'm a second year student and I'm working on my OOP project (Calculator). I'm done with the functions of the numeric buttons and operators. Now I'm in the stage of re-arranging my buttons. At first, I just set my button size to (50,50), it works…
3
votes
2 answers

Using a JPanel with a null layout

So I have a class called CalendarPanel that extends JPanel. It uses a null layout. How would I use CalendarPanel as a regular component? When I put it in another JPanel and then add it to a window, it disappears. It is only visible when I add it…
3
votes
1 answer

automatically resizing the jpanel

Is there anyway of getting JPanel resized (vertically) automatically as the components are added? I have assigned the layout manager to null.
FirmView
  • 3,130
  • 8
  • 34
  • 50
2
votes
1 answer

JSlider not drawing on null layout JPanel

I have a JPanel that has a null layout and I'm trying to add a JSlider: slider = new JSlider(); slider.setSize(300,30); slider.setPreferredSize(new Dimension(300,30)); int x =…
CodeGuy
  • 28,427
  • 76
  • 200
  • 317
2
votes
1 answer

java- repaint() method is misbehaving - 2?

This question is an extension of java- repaint() method is misbehaving? (Reading it, is optional) I am working on a Music Player I am using a JSlider as seek bar and using a JLabel to draw text on screen, such as song name. I am new to…
user13824394
2
votes
1 answer

Java Swing Add JPanel to JPanel

The Situation I am currently trying to build a 2D game with Java's Swing. For this, I have my main class Puzzle which is subclassing JFrame. To my frame I add my main JPanel which consists of several JPanels added together (each of them being a new…
Nordic88
  • 129
  • 1
  • 12
2
votes
2 answers

Java Graphics on a null layout

My end game for this panel is that I have an img icon be able to move around the screen and when they land on one of my what are currently buttons the new panel opens up and you get a mini game, i.e. true/false, maze, or word find. Where I am…
2
votes
2 answers

What are the things you have to do to make a panel work with a null layout manager?

I was having problems getting a null layout manager working, and I found this great page with things to remember when using a null layout manager. One of them was my issue, and I quickly moved on. I'm now having similar problems with another panel…
Erick Robertson
  • 32,125
  • 13
  • 69
  • 98
2
votes
2 answers

Swing text field visibility issue

I am trying to make a frame and add a text field inside it. For that I used JTextField. But it's not appearing. Code import java.awt.*; import javax.swing.*; class Tst { JFrame f; JTextField tf; public Tst() { f=new…
asad_hussain
  • 1,959
  • 1
  • 17
  • 27
2
votes
1 answer

JTable in JPanel Not Displaying

I don't understand where is the problem. The JTable is embedded in a JScrollPanel which is embedded in a JPanel. The table is not displaying. Any help appreciated. I probably missed to add some elements. Checked thoroughly but cannot find anything.…
ocram
  • 1,384
  • 6
  • 20
  • 36
2
votes
2 answers

Why JDialog not displaing properly

I have created a method to display message in a dialog but the size of the dialog changes each time I run my java swing application below is the link to screen shot of dailog: Improrer Message Box Display Proper Message Box Display Below is the…
Abhishek
  • 139
  • 2
  • 13
2
votes
1 answer

Using setBounds or setLocation on JTextArea isn't working

I am adding a JTextArea to my JPanel with this code: commentTextArea.setLineWrap(true); commentTextArea.setWrapStyleWord(true); commentTextArea.setVisible(true); this.add(commentTextArea); commentTextArea.setBounds(0, 0, 100,…
Harry
  • 772
  • 10
  • 32
2
votes
3 answers

How to add few the same image in one program by using JLabel?

I'm using Swing and I'm trying to add some picture in program. field = new JFormattedTextField(formatter); ImageIcon icon = new ImageIcon("background.png"), icon1 = new ImageIcon("1.png"); JLabel background = new JLabel(icon); JLabel…
user3648179
  • 35
  • 1
  • 5
1
2
3
15 16