Hi Guys, I ussually dont post anything here often, just get everything off of everyone elses questions, but I'm having a strange problem that im scratching my head over, I have a JTable where I can Add and remove rows... This is just for testing purposes, I'm about to make a ingrediants program. The thing is whenever I change one of the Comboboxes they all seem to change.. its really wierd, Could Someone run this and help me out, this is probably a stupid mistake? See my Code Below, My Main package doughtracker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; /** * * …

Member Avatar
Member Avatar
+0 forum 13

I have a JTable that has four columns. In the second column I have assigned a JComboBox to be the cell editor of my column.The problem that I encountered is that I cannot handle the combobox the way I want. **What I want is that after a user select an item in the combobox, the program should add a new row to the table model and shift the focus to this new row in the first cell. It should then not worry about the remaining columns, I will not allow them to be editable.** Please assist, I will post all …

Member Avatar
Member Avatar
+0 forum 9

Hi i have 2 tables customer (cabinet_num which is integer) and cabinet (cabinet_num Autoincrement and cabinet_title) in my java i can display cabinet title to let the user choose a cabinet..but i want to collect the cainet_number in my customer table customet.cabinet package cabinet; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JTextField; import javax.swing.SwingConstants; import java.awt.Font; import java.awt.Color; import javax.swing.UIManager; import javax.swing.JLabel; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.ScrollPane; import javax.swing.JScrollPane; import javax.swing.JTextArea; import java.awt.ComponentOrientation; import javax.swing.ScrollPaneConstants; import java.awt.Dimension; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import javax.swing.JScrollBar; import javax.swing.JComboBox; …

Member Avatar
Member Avatar
+0 forum 6

Hello good day. Thank you for trying to help. My problem is as follows. A few columns in my table, use a JComboBox as the editor for their cells. Each cell, in a row (via JComboBox) presents the same choices to the user. The user is allowed to choose from the options, just not the same option more than once for that row. That being said what I wish to accopmlish is this: Whenever selections are made from any JComboBox the next cells should present as options the remaining unselected choices. So basically whenever a particular choice is made, I …

Member Avatar
Member Avatar
+0 forum 23

Is there any way that I don't use lots of IF statements?,right now it is according to Index of combo box items. else if(e.getSource().equals(jcb1)) { int selectedindex = jcb1.getSelectedIndex(); String comb_string = (String)jcb1.getSelectedItem(); if(selectedindex==1) { try { //String sql_command ="select * , count(*) over (partition by 1) total_rows from Employer where Employername = ? "; String sql_command ="select * from Employer where Employername = ? "; PreparedStatement st=con.prepareStatement(sql_command); st.setString(1,comb_string); Result = st.executeQuery(); int test =0; String Store=""; String Response =""; test++; if(Result.next()) { String add1=Result.getString(3); first.setText(add1); String add2=Result.getString(28); second.setText(add2); String add3=Result.getString(4); third.setText(add3); String add4=Result.getString(6); fourth.setText(add4); if(test !=0) { /*Result.absolute(test); DisplayData();*/ …

Member Avatar
Member Avatar
+0 forum 1

Hello Daniweb Members, I am a beginner programmer and I have a problem, I am doing a PAT (Practical Assessment Task) for my school and I have come accross a huge problem, I'm trying to get a value from a selected combobox in Netbeans, (I am using the GUI builder), but I just don't know what is going on fullstop. I would like to use the variable from the combobox to decide which of the following frames it shall go to. This is my code, Please Help <3 ______________________________________________________________________________________ private void CargoTypeActionPerformed(java.awt.event.ActionEvent evt) { int value = 0; JComboBox typeCargo …

Member Avatar
Member Avatar
+0 forum 4

I want to update the contents of Jtable as shown below when the Jcombobox's item state is chaged in the left panel. but i am not being successful in it .Please help. ![untitled29](/attachments/large/2/untitled29.JPG "untitled29") when the table no value is changed in the left panel , i want corresponding Jtable values updated/refreshed as per the table number. how can i do this. please help.

Member Avatar
Member Avatar
+0 forum 8

I need to update the items of JCombobox from the database during runtime. I had made the JCombobox editable and what i need to do is type something in the editable combobox and search the database and only display the items matching the text. For example there are if i type "ap" in the editbox of JCombobox then i want only the items containing "ap" like "apes" and "apple" i can have them in the console during runtime but when i try to set those item as an items of Jcombobox i am getting error something including "MUtation....". how can …

Member Avatar
Member Avatar
+0 forum 17

only the first item in the combobox will be returened even if i selected another item. HELP! [CODE] try{ //combobox of the products rs = stmt.executeQuery(query2); rs.last(); int i = rs.getRow(); String [] v = new String [i]; rs.beforeFirst(); i = 0; while(rs.next()) { v[i] = rs.getString(2); i++; //break; } prodna = new JComboBox(v); } catch(Exception e) { } getContentPane().add(prodna); srch = prodna.getSelectedItem().toString(); //ordNo = new JLabel(srch); ordNo.setText(srch); label_5 = new JLabel("Product Name:"); //***Label getContentPane().add(label_5); label_6 = new JLabel("Quantity"); //***Label getContentPane().add(label_6); gqty = new JTextField(""); getContentPane().add(gqty); ok = new JButton("OK"); getContentPane().add(ok); cancel = new JButton("Cancel"); getContentPane().add(cancel); setSize(getPreferredSize()); ok.addActionListener(new ActionListener( ) …

Member Avatar
Member Avatar
+0 forum 1

run: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.sun.java.swing.plaf.nimbus.NimbusStyle.init(NimbusStyle.java:418) at com.sun.java.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:359) at com.sun.java.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:927) at com.sun.java.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:605) at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:896) at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:275) at javax.swing.plaf.synth.SynthLabelUI.updateStyle(SynthLabelUI.java:53) at javax.swing.plaf.synth.SynthLabelUI.propertyChange(SynthLabelUI.java:232) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276) at java.awt.Component.firePropertyChange(Component.java:8128) at java.awt.Component.setName(Component.java:935) at javax.swing.plaf.synth.SynthComboBoxUI$SynthComboBoxRenderer.getListCellRendererComponent(SynthComboBoxUI.java:409) at javax.swing.plaf.basic.BasicComboBoxUI.getDisplaySize(BasicComboBoxUI.java:1334) at javax.swing.plaf.basic.BasicComboBoxUI.getMinimumSize(BasicComboBoxUI.java:903) at javax.swing.plaf.basic.BasicComboBoxUI.getPreferredSize(BasicComboBoxUI.java:892) at javax.swing.JComponent.getPreferredSize(JComponent.java:1634) at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedPreferredSize(GroupLayout.java:2944) at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedMinimumSize(GroupLayout.java:2930) at javax.swing.GroupLayout$ComponentSpring.calculateMinimumSize(GroupLayout.java:2897) at javax.swing.GroupLayout$Spring.getMinimumSize(GroupLayout.java:1315) at javax.swing.GroupLayout$ComponentSpring.calculatePreferredSize(GroupLayout.java:2904) at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325) at javax.swing.GroupLayout$ComponentSpring.getBaseline(GroupLayout.java:2998) at javax.swing.GroupLayout$BaselineGroup.calculateBaselineAndResizeBehavior(GroupLayout.java:2657) at javax.swing.GroupLayout$BaselineGroup.calculateSize(GroupLayout.java:2633) at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568) at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325) at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1604) at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1593) at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568) at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325) at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1604) at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1588) at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568) at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325) at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1604) at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1588) at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568) at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325) at javax.swing.GroupLayout$SequentialGroup.setValidSize(GroupLayout.java:1972) at javax.swing.GroupLayout$Group.setSize(GroupLayout.java:1553) at javax.swing.GroupLayout.calculateAutopadding(GroupLayout.java:1058) at javax.swing.GroupLayout.layoutContainer(GroupLayout.java:899) at java.awt.Container.layout(Container.java:1421) at java.awt.Container.doLayout(Container.java:1410) at java.awt.Container.validateTree(Container.java:1507) …

Member Avatar
Member Avatar
+0 forum 11

Hi guys well I have created a JComboBox that lists all my values from a String. However I want instead of the values for the JComboBox to be in a String the values to be displayed in the JComboBox from my database so if more values are added to the database the values will be in the JComboBox. So how would I do this? Any help would be appricated My code is below that I have used: I'VE SOLVED MY PROBLEM REMOVED MY CODE:

Member Avatar
Member Avatar
+0 forum 2

Hi I am writing one simple program for upgrading my knowlegde from C# to Java but I am failed to attach ActionListener to JComboBox which is added to a cell of JTable at run time. Actually I want to perform update operation and delete operation on selecting Update or Delete item from JComboBox which is generated at runtime im a JTable. I am able to add JComboBox to the cell of JTable and also getting the seleted value from JComboBox on click event of JTable but, my requirement is not fullfilled by this. Here is my partial code - [CODE] …

Member Avatar
Member Avatar
+0 forum 2

I do not want to have my box this wide. I would like the text to wrap but I do not know how. Can I do this? I'd like my box to be 400,400 rather than 1250,200, but it is the only way I can get my text to fit. Or could I make a new box under the pull down menu that had this description in it. I do not know how to do it. - frame.add(panel3, BorderLayout.SOUTH); ??? [CODE]public class ComboBox{ String course[] = {"Menu","CIS212","CIS222","CIS406","CIS407","CIS326","CIS328","CIS493"}; String desc[] = {"Please choose a class from the menu", "System Modeling Theory: …

Member Avatar
Member Avatar
+0 forum 2

The End.