Questions tagged [null-layout-manager]
236 questions
2
votes
2 answers
How to give spaces between jlabel?
Hi i am trying to make java desktop application where i am using multiple jlabel i want to give little spaces between every label
how can i achieve this
here is my code
public class Second extends javax.swing.JFrame {
JLabel label=new JLabel();
…

user3456343
- 252
- 3
- 7
- 21
2
votes
2 answers
How to close Back Window
I have a Java class named Jtable. When I run this class it works fine but if I run this class 10 times then 10 new windows open and I do not want that, I want that if I run this java class any number of time it should close previous windows.
My code…
user3377703
2
votes
5 answers
Set layout with JPanels
I haven't really worked with Swing at all in Java. I'm experimenting with it. I want to make a set layout that the size can't be changed. I've seen alot of things suggesting to use Layout managers to add multiple JPanels into a JFrame.
However, all…

user2307421
- 51
- 1
- 2
- 6
2
votes
2 answers
JLabel won't show with JPanel.setLayout(null). Why?
I want to show many different labels over a map, so I'm using null layout in my panel, and calling setLocation for each label. For some reason, though, the labels don't show. If I remove the pan.setLayout(null), then the label appears in the…

Rodrigo
- 4,706
- 6
- 51
- 94
2
votes
2 answers
JLabels (And other things) wont show up inside a JPanel in a JFrame (multiple JFrames)
I've created an app but I have a problem with my JLabels not showing up properly. The app currently looks like this:
These are 2 JPanels inside a JFrame created with the following code:
public JFrame window = new JFrame();
public JPanel top = new…

Marc
- 1,094
- 3
- 17
- 38
2
votes
2 answers
Drawing a JComponent inside a JPanel
I am trying to display a JComponent inside a JPanel.
I am using null layout because location of the components can be changed during runtime and I have to control them.
But the following code does not work. The JComponent only becomes visible on…

Gabriel
- 21
- 3
2
votes
1 answer
Replacing ButtonGroupPanel from com.symantec.itools.javax.swing package
I am migrating 'Java Swing' code from 'Java Visual Cafe' JDK1.2 to 'Eclipse SDK6'. In Visual Cafe it has code is like this:
public Sample extends JPanel(){
.....
package com.symantec.itools.javax.swing.JButtonGroupPanel bgAcc = new…

Hanuman
- 23
- 4
2
votes
1 answer
JScrollPane doesn't appear
I would like to create a JscrollPane jsp in my panel panneau. But This JscroolPane doesn't appear. I think the trouble is that I use setLayout to null.
The code might produce a layout like this, the number of rows & columns of text fields are…

giovedy
- 123
- 2
- 4
- 10
2
votes
1 answer
Applet Components Not VIsible
I am Calling an Applet Class After Login. The form is Visible but the Components are Not Visible what COuld be the Issue; Here is My Class:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package…

Stanley Mungai
- 4,044
- 30
- 100
- 168
2
votes
1 answer
Manual Positioning of Image in JFrame
I am trying to create a JFrame that displays an image from a file path onto a particular position on the JFrame. At a later time (when a button is clicked), I want the image to move positions, say, 50 pixles to the left. If a layout manager is…

user1386318
- 23
- 4
1
vote
2 answers
Required null layout, for drawing + labels
I am making a small JFrame in which I draw a large triangle. On all the sides of the triangle there has to be a label. I have to position these labels myself, because of the irregular shape of the triangle (yes, there will also be a non-right-angled…

Hidde
- 11,493
- 8
- 43
- 68
1
vote
4 answers
Getting the X and Y position of the mouse when it is clicked on the image in JLabel
I have a Image displayed inside JLabel using ImageIcon feature.
The JLabel is contained inside a JPanel.
When image is clicked, I want to get the mouse position relative to the image.
I am trying to solve this problem by adding mouse listener to…

user482594
- 16,878
- 21
- 72
- 108
1
vote
0 answers
How to bring JTextField to front?
I'm having a problem creating a Java GUI.
enter image description here
I'm creating a simple wordle game just to get the hang of GUI in Java. The idea is the program picks a random 5 letter word from a text file and the user gets 6 guesses to guess…
user18268755
1
vote
3 answers
Java Swing: Trying to get a button to center
I'm trying to make a login page for an idea I'm working on and am trying to center two buttons. When I get the screen dimensions and divide them by 2 it is not centered. Here's my code:
import javax.swing.*;
import java.awt.*;
public class…

JE Krupat
- 91
- 6
1
vote
0 answers
JLabel centering
I have a JFrame which contains a JPanel, in the JPanel I have multiple JTextField and JLabel components. My text fields are already centered by setting their bounds, but how can I center my label's texts horizontally and change the vertical location…

learningJava2020
- 97
- 8