Article View: borland.public.jbuilder.java.swing
Article #9901Re: Simple Question
From: Paul Furbacher [TeamB]
Date: Sat, 01 Jan 2000 00:00
Date: Sat, 01 Jan 2000 00:00
47 lines
2623 bytes
2623 bytes
Jeff Marendo wrote:
> 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.
[...]
> 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. ...
One of the constraints of the Designer is that it cannot execute
methods you put in the "jbInit()" method. The Deisgner simply
ignores your "setInsertButton()" because of the way it goes
about its business of translating your designs into code and back
Also, think about this issue: if you made changes to the
button in the Designer, how would it know to put that
code in your special method? It would be great if it could be
that smart but that's asking quite a lot of a Designer which
is pretty amazingly good as it is currently.
If you need to tidy things up, you do that later, after you are satisfied
with the design. However, that's really not a great idea because
designs -- even the best of them -- change over time. Perhaps if
Sun pushes forward with XML and interface design, there'll come a
time when complete separation of interface design and "model/controller"
code is possible. For right now, you have to live with the very few
constraints of the Designer.
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<386EB770.38C7683B@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<83tdra$t506@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,48efee8c83d81be2 X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu> Subject: Re: Simple Question Date: 2000/01/01 Message-ID: <386EB770.38C7683B@bilbo.bio.purdue.edu> X-Deja-AN: 567281028 Content-Transfer-Encoding: 7bit References: <83tdra$t506@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing