what to use on jComboBox to get data from database

I'm trying to setText some data from my database

Page 1 of 1

2 Replies - 5501 Views - Last Post: 10 June 2008 - 03:44 PM Rate Topic: -----

#1 dushi   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 40
  • Joined: 23-February 08

what to use on jComboBox to get data from database

Post icon  Posted 10 June 2008 - 10:54 AM

Hello, i create a form. the user must be able to fill in the form. i must be able to delete any user, modify a form from a user and see a filled in form from a user.
'm working with setText to set the data from my database, so i can modify a filled form from a user.
the problem is a know what to do with the jtextField type. but i dont know what to do with the jComboBox and the JRadioButton type
here is my code so far.
public Frame2() 
  {
	this (null,true);
  }
  public Frame2(java.awt.Frame parent, boolean modal)
  {
	super(parent, modal);
	try{
	  jbInit();
	}
	catch(Exception exception)
	{
	  exception.printStackTrace();
	}
  }
  public void setCursus(String c)
  {
	jComboBox1.setEnabled(c);
  }
  
 public void setInschtijfDatum(String i)
  {
	jComboBox2.setText(i);
  }
  
  public void setAchternaam(String a)
  {
	jTextField1.setText(a);
  }
  
  public void setVoornaam(String v)
  {
  jTextField2.setText(v);
  }
  
  public void setInitialen(String in)
  {
  jTextField3.setText(in);
  }

  public void setIDnummer(String id)
  {
  jTextField4.setText(id);
  }
  
  public void setGeslacht(String g)
  {
	jRadioButton1.setText(g);
  }
  
  public void setGeslacht(String g)
  {
	jRadioButton2.setText(g);
  }



This post has been edited by dushi: 10 June 2008 - 12:33 PM


Is This A Good Question/Topic? 0
  • +

Replies To: what to use on jComboBox to get data from database

#2 Jayman   User is offline

  • Student of Life
  • member icon

Reputation: 423
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: what to use on jComboBox to get data from database

Posted 10 June 2008 - 11:12 AM

Modified title to be more descriptive.
Was This Post Helpful? 0
  • +
  • -

#3 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8379
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: what to use on jComboBox to get data from database

Posted 10 June 2008 - 03:44 PM

Where is your class Frame2 defined ? What does it extends ?
What is jbInit() ?

You could select * from your database. Put the right column in a Vector and create your JComboBox with ths Vector as parameter.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1