|
From: Ramon W. <ra...@ja...> - 2003-07-14 18:00:51
|
-------- > I believe that using the textfield will be enough. I have not tested i= t > though. If you could post back your results, that would be appreciated= =2E > = > Thanks ! > Fran=E7ois > = =2E =2E =2E > > > = > > Yes, that would be much handier. Do I need to use a JTextArea as Igo= r > > Kromin = > > did in his example, or can I add the pane to the JGB textfield? > > = > > Ramon > > = =2E =2E =2E Francois, You are correct, the textfield works fine. I will include my whole XML t= hat = creates the textarea, just for reference. [It also creates textfields and= a = combobox in a GridBagLayout]. The method seems to be: = 1) Create an object for the JViewport 2) After textarea is defined, define the scrollpane w/ scroll parameters = and = add the viewport defined in 1) as a property of the scroll. 3) Add a method call to add the viewport object. Not as bad as I thought at first. Ramon <!DOCTYPE window PUBLIC "-//SOURCEFORGE/Java Gui Builder DTD version 1.0/= /EN" = "http://jgb.sourceforge.net/dtd/jgb.dtd"> <window id=3D"BookStore" type=3D"jframe"> <object id=3D"window.size" class=3D"java.awt.Dimension"> <constructor> <parameter name=3D"width"> <value type=3D"int" data=3D"450"/> </parameter> <parameter name=3D"height"> <value type=3D"int" data=3D"350"/> </parameter> </constructor> </object> <!-- // This is the view port we will use --> <object id=3D"outputView" class=3D"javax.swing.JViewport"> <constructor /> </object> <controls> <layout class=3D"GridBagLayout"/> <constraints> <gridbag fill=3D"NONE" anchor=3D"EAST" gridx=3D"0" gridy=3D"0" inse= ts=3D"5,5,5,5" = weightx=3D"0.0" weighty=3D"1.0" gridheight=3D"1" gridwidth=3D"1"/> </constraints> <label id=3D"labelTitle" text=3D"Title"/> <constraints> <gridbag gridx=3D"1" fill=3D"HORIZONTAL" gridheight=3D"1" gridwidth= =3D"2" = weightx=3D"1.0"/> </constraints> <textfield id=3D"tfTitle"/> <constraints> <gridbag fill=3D"NONE" anchor=3D"EAST" gridx=3D"0" gridy=3D"1" inse= ts=3D"5,5,5,5" = weightx=3D"0.0" weighty=3D"1.0" gridheight=3D"1" gridwidth=3D"1"/> </constraints> <label id=3D"labelAuthor" text=3D"Author"/> <constraints> <gridbag gridx=3D"1" fill=3D"HORIZONTAL" gridheight=3D"1" gridwidth= =3D"2" = weightx=3D"1.0"/> </constraints> <textfield rows=3D"4" id=3D"taAuthor"/> <control class=3D"JScrollPane" id=3D"outputPane"> <property name=3D"verticalScrollBarPolicy"> <constant name=3D"javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS" /> </property> <property name=3D"horizontalScrollBarPolicy"> <constant name=3D"javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED" = /> </property> <property name=3D"viewport"> <ref refid=3D"outputView" /> </property> </control> <constraints> <gridbag fill=3D"NONE" anchor=3D"EAST" gridx=3D"0" gridy=3D"2" inse= ts=3D"5,5,5,5" = weightx=3D"0.0" weighty=3D"1.0" gridheight=3D"1" gridwidth=3D"1"/> </constraints> <label id=3D"labelGenre" text=3D"Genre"/> <constraints> <gridbag gridx=3D"1" fill=3D"HORIZONTAL" gridheight=3D"1" gridwidth= =3D"2" = weightx=3D"1.0"/> </constraints> <combo id=3D"comboGenre" choices=3D"General Fiction,Gothic = Romance,Mystery,Nonfiction,Science Fiction"/> <constraints> <gridbag fill=3D"NONE" anchor=3D"EAST" gridx=3D"0" gridy=3D"3" inse= ts=3D"5,5,5,5" = weightx=3D"0.0" weighty=3D"1.0" gridheight=3D"1" gridwidth=3D"1"/> </constraints> <label id=3D"labelDate" text=3D"Date"/> <constraints> <gridbag gridx=3D"1" fill=3D"HORIZONTAL" gridheight=3D"1" gridwidth= =3D"2" = weightx=3D"1.0"/> </constraints> <textfield id=3D"tfDate"/> <constraints> <gridbag fill=3D"NONE" anchor=3D"EAST" gridx=3D"0" gridy=3D"4" inse= ts=3D"5,5,5,5" = weightx=3D"0.0" weighty=3D"1.0" gridheight=3D"1" gridwidth=3D"1"/> </constraints> <label id=3D"labelISBN" text=3D"ISBN"/> <constraints> <gridbag gridx=3D"1" fill=3D"HORIZONTAL" gridheight=3D"1" gridwidth= =3D"2" = weightx=3D"1.0"/> </constraints> <textfield id=3D"tfISBN"/> <constraints> <gridbag fill=3D"NONE" anchor=3D"EAST" gridx=3D"0" gridy=3D"5" inse= ts=3D"5,5,5,5" = weightx=3D"0.0" weighty=3D"1.0" gridheight=3D"1" gridwidth=3D"1"/> </constraints> <label id=3D"labelPublisher" text=3D"Publisher"/> <constraints> <gridbag gridx=3D"1" fill=3D"HORIZONTAL" gridheight=3D"1" gridwidth= =3D"2" = weightx=3D"1.0"/> </constraints> <textfield id=3D"tfPublisher"/> </controls> <methodCall refid=3D"outputView" method=3D"add"> <parameter> <ref refid=3D"taAuthor" /> </parameter> </methodCall> <methodCall refid=3D"BookStore" method=3D"pack"/> <methodCall refid=3D"BookStore" method=3D"setDefaultCloseOperation"> <parameter> <constant name=3D"javax.swing.WindowConstants.DISPOSE_ON_CLOSE"/> </parameter> </methodCall> <methodCall refid=3D"BookStore" method=3D"setVisible"> <parameter> <value type=3D"boolean" data=3D"true"/> </parameter> </methodCall> <property name=3D"title"> <value type=3D"string" data=3D"Book Store Application"/> </property> <property name=3D"size"> <ref refid=3D"window.size"/> </property> </window> -- = --- #########################################################################= ##### Ramon L. Williamson II INTERNET: ra...@nc... Research Programmer Voice: (217) 244-4208 Radio Astronomy Imaging Team National Center for Supercomputing Applications (NCSA) I tried to learn the piano, but I was getting errors with #include<mozar= t.h>. *************************************************************************= **** |