Results 1 to 6 of 6
Thread: Combobox
- 02-19-2012, 07:43 PM #1
Member
- Join Date
- Feb 2012
- Location
- Norway
- Posts
- 96
- Rep Power
- 0
- 02-19-2012, 09:03 PM #2
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,143
- Rep Power
- 5
Re: Combobox
So what is your problem?
Do you know how to use SQL? Do you know how to create a loop to get all the data from the ResultSet?
Do you know how to hard code data and create a ComboBoxModel?
- 02-19-2012, 09:10 PM #3
Re: Combobox
Have you decided which GUI toolkit you would like to use for this? AWT? Swing? SWT? JFace? Something else?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-19-2012, 10:02 PM #4
Member
- Join Date
- Feb 2012
- Location
- Norway
- Posts
- 96
- Rep Power
- 0
Re: Combobox
I'm using Netbeans as GUI toolkit. Swing combobox
I know how to use SQL. The problem is the resultset.
An example would be great.
- 02-19-2012, 10:04 PM #5
- 02-21-2012, 07:11 PM #6
Member
- Join Date
- Feb 2012
- Location
- Norway
- Posts
- 96
- Rep Power
- 0
Re: Combobox
Sorry, I have been away for a few days...
First I have a line of query to the database:
Actually the connection and query is in its own class...Java Code:public class ComboForm extends javax.swing.JFrame { private VectorData vectordata = LedgerTable.SelectAll();
Heres the code generated by Netbeans, including one line of custom code:
The custom line is this one:Java Code:private void initComponents() { jComboBox1 = new javax.swing.JComboBox(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jComboBox1.setModel(vectordata.getData()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(112, 112, 112) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(138, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(83, 83, 83) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(195, Short.MAX_VALUE)) ); pack(); }
Hopefully you have enough information to guide me to the correct custom line here...Java Code:jComboBox1.setModel(vectordata.getData());
Similar Threads
-
combobox
By dina in forum AWT / SwingReplies: 7Last Post: 05-11-2011, 05:31 PM -
combobox
By leader in forum New To JavaReplies: 2Last Post: 02-12-2011, 09:30 PM -
Problem in combobox
By santhosh_el in forum AWT / SwingReplies: 4Last Post: 04-03-2009, 04:01 AM -
Need Help combobox
By kwink in forum AWT / SwingReplies: 3Last Post: 03-21-2009, 10:05 AM -
combobox
By chandu.v in forum New To JavaReplies: 2Last Post: 07-02-2008, 08:36 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks