🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Simple Question

#9881
From: Jeff Marendo
Date: Thu, 23 Dec 1999 00:00
39 lines
2131 bytes
Hello,

I'm looking at my code right now, and I think I'm losing my mind.  I created
a class in JBuilder3 that extends from JPanel.  My class has three JButtons
that I'm trying to add to it.  These buttons aren't special, really.  I just
want to add them to my panel, but what I'm trying to is to have a 'set'
function for each button that is called from jbInit( ).  This way I don't
have a ton of extraneous lines of code there.  The problem is that my
buttons are not being added to my panel.  Here is code for one of my
buttons:

public class TNSwapToolPanel extends JPanel {
  XYLayout tnSwapToolPanelLayout = new XYLayout();
  JButton btn_insert = new JButton();
  ...

private void jbInit() throws Exception {
    this.setLayout(tnSwapToolPanelLayout);
    this.setBackground(Color.white);
    setInsertButton(btn_insert, this);
    ...

private void setInsertButton(JButton button, TNSwapToolPanel panel) {
    button.setText("Insert");
    button.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    button.setBorder(BorderFactory.createLineBorder(Color.black));
    button.setBackground(Color.blue);
    button.setForeground(Color.white);
    button.setMnemonic('i');
    // button.addMouseListener(cursDet);
    this.add(button, new XYConstraints(8, 12, 67, -1));
  }

Maybe I'm going about this the wrong way, but it seems like it should work.
I can clearly see that the buttons aren't being added to the panel when I go
to the 'Design' tab in JBuilder3.  Please steer me in the right direction if
anyone can see what I'm doing wrong.  Thanks in advance.

Jeff
Technical Details
Message-ID: <83tdra$t506@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,48efee8c83d81be2,start
X-Google-Attributes: gid111d45,public
From: "Jeff Marendo" <marendoj@commos.com>
Subject: Simple Question
Date: 1999/12/23
Message-ID: <83tdra$t506@forums.borland.com>
X-Deja-AN: 564212548
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Organization: CommTech Corporation
X-MSMail-Priority: Normal
Reply-To: "Jeff Marendo" <marendoj@commos.com>
Newsgroups: borland.public.jbuilder.java.swing