🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1347

jpanel and borders stange behauviour

#1347
From: Sven Goetgeluck
Date: Fri, 16 Jan 2004 00:22
95 lines
3445 bytes
Hi ,

I have a jpanel where i add a jpanel component to but ther is a border
around the last panel
short explanation what i want to do

a have a buttonpanel where i have put some buttons on it
this pannel is added to another panel where there is also a jlabel on it so
i can display tips to the label when i pass the buttons but the anoyong
thing is that adding a panel to the other panel there is a border around and
so the buttons arent alignt top to the upper paneltop

hope this is clear what i mean

did started when using jdk 1.4 didn't never had it in 1.2




hereby some code that may help

the first is the "buttonpanel"


<code>
public class VideoControllPanel
extends JPanel {
JButton menubarplayButton = new JButton();
..
GridLayout gridLayout = new GridLayout(1,9);
JToolBar toolbar = new JToolBar();
Color bcolor = new Color(76,90,109);

public VideoControllPanel(Frame1 p, ResourceBundle r, ResourceBundle i) {

jbInit();
}

private void jbInit() {
toolbar.setLayout(gridLayout);

setBackground(bcolor);
setForeground(bcolor);
toolbar.setBackground(bcolor);
toolbar.setForeground(bcolor);

menubarplayButton.setBackground(bcolor);
menubarplayButton.setMaximumSize(new Dimension(50, 20));
menubarplayButton.setMinimumSize(new Dimension(50, 20));
menubarplayButton.setPreferredSize(new Dimension(50, 20));
menubarplayButton.setMargin(new Insets(0, 0, 0, 0));
menubarplayButton.setIcon(new ImageIcon(images.getString("PLAY")));
menubarplayButton.setPressedIcon(new
ImageIcon(images.getString("PLAY_IN")));
menubarplayButton.setRolloverIcon(new
ImageIcon(images.getString("PLAY_OUT")));
menubarplayButton.setBorderPainted(false);

menubarplayButton.setFocusPainted(false);
menubarplayButton.setToolTipText(recources.getString("PLAY_TOOLTIP"));
menubarplayButton.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(ActionEvent e) {
menubarplayButton_actionPerformed(e);
}
});


toolbar.add(menubarloopButton, null);
....
this.add(toolbar);
}
<\code>

// the mainpanel where the buttonpanel is added to
this way

movieToolBar.add(videocontrol, null);

<code>
movieToolbar = new JToolbar();

movieToolBar.setBackground(new java.awt.Color(76, 90, 109));
movieToolBar.setForeground(new java.awt.Color(76, 90, 109));
movieToolBar.setAlignmentX( (float) 0.0);
movieToolBar.setBorder(null);
movieToolBar.setBorderPainted(false);
movieToolBar.setMargin(new Insets(0, 0, 0, 0));

movieToolBar.setFloatable(false);


<\code>

thanks for the help
Technical Details
Message-ID: <40072ea6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,bdf82a54cfa1b9fa,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-01-15 16:40:02 PST
From: "Sven Goetgeluck" <sven.goetgeluck@pandora.be>
Newsgroups: borland.public.jbuilder.java.swing
Subject: jpanel and borders stange behauviour
Date: Fri, 16 Jan 2004 01:22:01 +0100
Lines: 97
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.224.11.244
Message-ID: <40072ea6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074212518 213.224.11.244 (15 Jan 2004 16:21:58 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail