From: Pavel T. <pau...@ya...> - 2000-12-05 03:24:17
|
Irwan, I changed your code a little bit, now it shows both JLabel and JText. But jL.setBounds do not work anyway (and will not work) because you use layout manager. That means container will not take current component size into account, but only preferred size (for labels, it is computed based on label text, some insets and font that will be used for rendering). Hope this helps, Pavel PS I did not try it with Jython -- I still use JPython 1.1 but it should not make any difference for your question. from pawt import swing import java frame=swing.JFrame("Test",visible=1) frame.contentPane.layout = java.awt.FlowLayout() jL=swing.JLabel("Python") frame.contentPane.add(jL) jL.setBounds(10,10,10,10) jT=swing.JTextField("Test",10) frame.contentPane.add(jT) frame.setSize(300,200) frame.show() --- irwan <ry...@tm...> wrote: > Hi all, > > I would like to write a simple GUI (java swing) with > jython which have a JLabel and JTextField. > My problem is to setbouds to JLabel but it doesn't > effect it. Meanwhile in JTextField, i cannot to set > the size. My screen show white color with text > "Test" in the middle. > > from pawt import swing > import java > > frame=swing.JFrame("Test",visible=1) > a=java.awt.FlowLayout() > jL=swing.JLabel("Python") > frame.contentPane.add(jL).setLayout(a) > jL.setBounds(10,10,10,10) > jT=swing.JTextField("Test",10) > frame.contentPane.add(jT).setLayout(a) > frame.setSize(300,200) > frame.show() > > __________________________________________________ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/ |