Samooramad
asked on
increase internal frame hieght
Hi experts,
I have an internal frame with a text field. Each time the text field enters a word it is dispayed on the internal frame as labels (under each other)
the internal frame has a scrollbar but the frame stays the same size while the words are entered and you need to maximize it to see them all.
I would like it to gradually increase in hieght as each name is entered.
thanks
I have an internal frame with a text field. Each time the text field enters a word it is dispayed on the internal frame as labels (under each other)
the internal frame has a scrollbar but the frame stays the same size while the words are entered and you need to maximize it to see them all.
I would like it to gradually increase in hieght as each name is entered.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
both worked great
thanks guys
thanks guys
I dont know if this is what you want but this example extends the size of a JInternalFrame every time
you add a letter to the label of a JInternalFrame. Hope yo like it.
/**
* Sample Class to Gradualy Refresh the Size of a
* JInternalFrame in Every Text Entered on a
* JTextField Component
*
* Made By : Javatm
* Date : 08/15/2004
* Time : 11:59 AM PH
*
**/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
public class Sample extends JFrame {
private Document doc;
private int HightX = 300;
private int WidthY = 200;
private JInternalFrame f1;
private JDesktopPane d1;
private JTextField t1;
private JLabel l1;
private JPanel p1;
private JPanel p2;
private String s1;
public Sample() {
super("Sample . . .");
d1 = new JDesktopPane();
f1 = new JInternalFrame("", true, true, true, true);
p1 = new JPanel();
p2 = new JPanel();
l1 = new JLabel("Enter Text Here : ");
t1 = new JTextField(10);
doc = t1.getDocument();
p1.setLayout(new GridLayout(3,1));
p1.add(new JPanel());
p1.add(p2);
p1.add(new JPanel());
p2.add(l1); p2.add(t1);
f1.setSize(HightX, WidthY);
f1.setVisible(true);
f1.add(p1);
d1.add(f1);
this.getContentPane().add(
setSize(400, 350);
setVisible(true);
doc.addDocumentListener(ne
{
public void changedUpdate(DocumentEven
{
f1.setTitle(t1.getText());
f1.setSize(HightX, WidthY);
HightX++; WidthY++;
}
public void insertUpdate(DocumentEvent
{
f1.setTitle(t1.getText());
f1.setSize(HightX, WidthY);
HightX++; WidthY++;
}
public void removeUpdate(DocumentEvent
});
}
public static void main(String args[]) {
Sample x = new Sample();
x.setDefaultCloseOperation
}
}
Hope that helps . . .
Javatm