This week's book giveaway is in the Spring forum.
We're giving away four copies of Modern frontends with htmx and have Wim Deblauwe on-line!
See this thread for details.
Win a copy of Modern frontends with htmx this week in the Spring forum!

Grant Currey

Greenhorn
+ Follow
since Oct 14, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Grant Currey

I couldnt get your code to compile, so i made a minor alteration to your main and to the line one. You need to use setVisible() not setvisible().
secondly i added in validate(); after u add that component.
here is the adjusted source code
import java.awt.*;
import java.awt.event.*;
class TestAwt extends Frame implements ActionListener
{
Panel p1,p2;
Button b1,b2,b3;
TestAwt()
{
p1 = new Panel();
p2 = new Panel();
b1 = new Button("One");
b2 = new Button("Two");
b3 = new Button("Three");
setLayout(new BorderLayout());
add(p1,"North");
add(p2,"South");
p1.setLayout(new FlowLayout());
p1.add(b1);
p1.add(b2);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == b1)
{
p2.add(b3);
validate();
b3.setVisible(true); // line 1
}
}
public static void main(String []arg)
{
Frame f = new TestAwt();
f.setVisible(true);
f.setSize(400,400);
}
};
21 years ago
I need to change the default width of the awt.List component.
It is to thin for my text and i need it to be wider withou a verticle scroll bar.
Can anyone help.
I have tried various methods inherited from the component super class and still had no luck.
21 years ago