Will resetting an object be less expensive then reinstantiating?

From: Inertia_sublimation (inertia_sublimation_at_hotmail.com)
Date: 02/28/04


Date: Sat, 28 Feb 2004 03:15:10 GMT

Hi everyone!

I was wondering, I've been doing some work with GridBagLayout, and have
noticed my overuse of
"= new GridBagCostraints". I decided to create a new class,
ReusableGridBagComponents, inherit from
GBC, and make a reset method. This reset method would reset the GBC's public
fields to their default values,
so I can use the same GBC to position a new component. (I'll just pass that
same RGBC to the getContentPane().add() method.)

Does this have any consequences to it? I had the mentality that more objects
== more heap use, so it was best to conserve that heap space.

Thanks in advance!



Relevant Pages

  • Re: gridbag layout
    ... ab GridBagLayout, I tried to learn from experiments. ... public class Main { ... GridBagConstraints gbc = new GridBagConstraints; ...
    (comp.lang.java.programmer)
  • gridbag layout
    ... ab GridBagLayout, I tried to learn from experiments. ... JTextField userIdField = new JTextField; ... GridBagConstraints gbc = new GridBagConstraints; ... But how can I add spacing between the heading label and ...
    (comp.lang.java.programmer)
  • GridBagLayout not behaving as specified
    ... I have a problem with GridBagLayout that I would appreciate some help with in solving. ... The problem is that the button is taking up the same amount of space as the password field even though the password field has a grid width of 4 and the button only 1. ... private JTextField userTextField = new JTextField; ... GridBagConstraints gbc = new GridBagConstraints; ...
    (comp.lang.java.gui)
  • Which layout manager for this case?
    ... I've tried all layout managers so far and no one did what I wanted it to. ... know GridBagLayout will do the job but I cannot figure out how to use it. ... I want to have several components width different heights to be aligned ... parentComponent.add(this, gbc); ...
    (comp.lang.java.programmer)
  • Re: Cannot divide into an 1:2 fashion by GridBagLayout
    ... You need to read up a little more on GridBagLayout and its ... private GridBagConstraints gbc; ... Container window = getContentPane; ...
    (comp.lang.java.gui)