How do i create a combo-box?
Dear guys..how do i create a simple combo-box that get populated with data fron the database at run-time? I can create pop-lists , but that is hardcoded and no good to me.
Kind Regards
cheers folks..most helpful :)
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected]:
Hi, Satnam Bihal
I think this code will solve your problem.
DECLARE
rgid RECORDGROUP ;
err NUMBER ;
BEGIN
:main.dynamic_list := '' ;
:main.list_value := '' ;
IF :main.sql_text IS NOT NULL THEN
CLEAR_LIST('main.dynamic_list') ;
rgid := CREATE_GROUP_FROM_QUERY('rg', :main.sql_text) ;
err := POPULATE_GROUP(rgid) ;
POPULATE_LIST('dynamic_list', rgid) ;
DELETE_GROUP(rgid) ;
END IF ;
END ;<HR></BLOCKQUOTE>
null
Similar Messages
-
How can I make the combo box turn to the value of black.
When the show button is pressed (and not before), a filled black square should be
displayed in the display area. The combo box (or drop down list) that enables the user to choose the colour of
the displayed shape and the altering should take effect immediately.When the show button is pressed,
the image should immediately revert to the black square, the combo box should show the value that
correspond to the black.
Now ,the problem is: after I pressed show button, the image is reverted to the black square,but I don't know
how can I make the combo box turn to the value of black.
Any help or hint?Thanks a lot!
coding 1.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class test extends JFrame {
private JPanel buttonPanel;
private DrawPanel myPanel;
private JButton showButton;
private JComboBox colorComboBox;
private boolean isShow;
private int shape;
private boolean isFill=true;
private String colorNames[] = {"black", "blue", "cyan", "darkGray", "gray",
"green", "lightgray", "magenta", "orange",
"pink", "red", "white", "yellow"}; // color names list in ComboBox
private Color colors[] = {Color.black, Color.blue, Color.cyan, Color.darkGray,
Color.gray, Color.green, Color.lightGray, Color.magenta,
Color.orange, Color.pink, Color.red, Color.white, Color.yellow};
public test() {
super("Draw Shapes");
// creat custom drawing panel
myPanel = new DrawPanel(); // instantiate a DrawPanel object
myPanel.setBackground(Color.white);
// set up showButton
// register an event handler for showButton's ActionEvent
showButton = new JButton ("show");
showButton.addActionListener(
// anonymous inner class to handle showButton events
new ActionListener() {
// draw a black filled square shape after clicking showButton
public void actionPerformed (ActionEvent event) {
// call DrawPanel method setShowStatus and pass an parameter
// to decide if show the shape
myPanel.setShowStatus(true);
isShow = myPanel.getShowStatus();
shape = DrawPanel.SQUARE;
// call DrawPanel method setShape to indicate shape to draw
myPanel.setShape(shape);
// call DrawPanel method setFill to indicate to draw a filled shape
myPanel.setFill(true);
// call DrawPanel method draw
myPanel.draw();
myPanel.setFill(true);
myPanel.setForeground(Color.black);
}// end anonymous inner class
);// end call to addActionListener
// set up colorComboBox
// register event handlers for colorComboBox's ItemEvent
colorComboBox = new JComboBox(colorNames);
colorComboBox.setMaximumRowCount(5);
colorComboBox.addItemListener(
// anonymous inner class to handle colorComboBox events
new ItemListener() {
// select shape's color
public void itemStateChanged(ItemEvent event) {
if(event.getStateChange() == ItemEvent.SELECTED)
// call DrawPanel method setForeground
// and pass an element value of colors array
myPanel.setForeground(colors[colorComboBox.getSelectedIndex()]);
myPanel.draw();
}// end anonymous inner class
); // end call to addItemListener
// set up panel containing buttons
buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(4, 1, 0, 50));
buttonPanel.add(showButton);
buttonPanel.add(colorComboBox);
JPanel radioButtonPanel = new JPanel();
radioButtonPanel.setLayout(new GridLayout(2, 1, 0, 20));
Container container = getContentPane();
container.setLayout(new BorderLayout(10,10));
container.add(myPanel, BorderLayout.CENTER);
container.add(buttonPanel, BorderLayout.EAST);
setSize(500, 400);
setVisible(true);
public static void main(String args[]) {
test application = new test();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
coding 2
import java.awt.*;
import javax.swing.*;
public class DrawPanel extends JPanel {
public final static int CIRCLE = 1, SQUARE = 2;
private int shape;
private boolean fill;
private boolean showStatus;
private int shapeSize = 100;
private Color foreground;
// draw a specified shape
public void paintComponent (Graphics g){
super.paintComponent(g);
// find center
int x=(getSize().width-shapeSize)/2;
int y=(getSize().height-shapeSize)/2;
if (shape == CIRCLE) {
if (fill == true){
g.setColor(foreground);
g.fillOval(x, y, shapeSize, shapeSize);
else{
g.setColor(foreground);
g.drawOval(x, y, shapeSize, shapeSize);
else if (shape == SQUARE){
if (fill == true){
g.setColor(foreground);
g.fillRect(x, y, shapeSize, shapeSize);
else{
g.setColor(foreground);
g.drawRect(x, y, shapeSize, shapeSize);
// set showStatus value
public void setShowStatus (boolean s) {
showStatus = s;
// return showstatus value
public boolean getShowStatus () {
return showStatus;
// set fill value
public void setFill(boolean isFill) {
fill = isFill;
// set shape value
public void setShape(int shapeToDraw) {
shape = shapeToDraw;
// set shapeSize value
public void setShapeSize(int newShapeSize) {
shapeSize = newShapeSize;
// set foreground value
public void setForeground(Color newColor) {
foreground = newColor;
// repaint DrawPanel
public void draw (){
if(showStatus == true)
repaint();Hello,
does setSelectedIndex(int anIndex)
do what you need?
See Java Doc for JComboBox. -
Creating a combo box to change graph type
Hello Gurus,
I need to create a combo box in a web page to change the graph type used. How would I go about to achieve this?
Thanks.ceate the second combo box , at the palce where i will create the first combo boxAs i see .. u dont require two comboboxes in u r case just have to set the combobox with different ComboBoxModel each time u make a selection.
in listener event of the combobox change the model with setModel function. You can create new model by
combo1.setModel(new JComboBox(new Object[]{"opt1","opt2","opt3","opt4"}).getModel()); -
How I can stop the combo box with list of values from fireing validations
Hi I'm using Jdeveloper 11.1.2.3.0
Using Hr Schema employees table
I Display employees data in af:table
and I make List Of values on Department_id filed to easy change the employee department
and another one on Job_id filed
and Imake them UI Hints as ( combo box with list of values ) in the employeesVO
the problem is when I Select a value from department or jobs ( combo box with list of values )
fires the entire filed validations for mandatory atributes
Note : the af:table Property ( contedelivery) is set to (immediate )
How I can stop the combo box with list of values from fireing validationscheck it out.,
http://andrejusb.blogspot.in/2012/09/what-to-do-when-adf-editable-table.html -
How do i create a mail box in the SMTP server thru a java program
How do i create a mail box in the SMTP server thru a java program. If it is possible thru a java program.pls suggest a mail server compatible for the above possibility to work.
pls help ....Please let me know if it is not at all possible to
create a user account automatically thru a program
(java) in a mail server... how does yahoo work
then..does he manually add a user to the mail
server...By talking to a web server not a mail server.
>
Is not there any mail server that will allow us to
create mailboxes for my java program.. how do the
other web account services work..
As I said mail servers do have management interfaces. You need to find one and then determine what the management interface is. -
How does one create a "check box" in a cell?
How does one create a "check box" in a cell?
select the cell then open the cell formatter:
process should be similar in the iOS version. I do not have any iOS devices with Numbers so I cannot check. I did find this link that may help:
http://support.apple.com/kb/PH3374?viewlocale=en_US -
How do you add a combo box into a Jfilechooser?
how do you add a combo box into a Jfilechooser?
thanksSee the API For JFileChooser
public void setAccessory(JComponent newAccessory)Extend a JPanel or Such like, put your Combo Box on it, fiddle around with event handling code for the ComboBox..
Set an Instance of that as The Accessory for the JFileChooser.
Look In Your Docs:-
<JAVA_HOME>/Demo/jfc/SwingSet2/src , unpack SwingSet2.jar if neccessary
In there is a demo of using A JFileChooser with an accessory Panel, and Source code that is adaptable... -
How do you create a seach box in MUSE?
how do you create a seach box in MUSE? - viewer enters a keyword and will be lead to correct product
Hi there - For questions about individual programs, you're better off posting in their specific forums. Here's the Muse forum: http://forums.adobe.com/community/muse/general_questions_about_adobe_muse
That being said, there is currently not a search bar widget that can be added to a site directly from within Muse. However, you can add custom HTML code to your page, with a method such as this: http://www.ehow.com/how_6772398_embed-google-search-bar.html. Just add the custom HTML to your Muse page by going to Object > Insert HTML.
This page might also help you out: http://www.adobe.com/products/muse/embedded-html.edu.html
Good luck! -
Creating "Control Combo Box " Relation with data block
Hi all dears
i am switching from C# to oracle developer for joining gulf net software house, i have a problem regarding master detail data
the senerio is
"List items" control Filled programatically as under shortly:-
rg_id := create_group_from_query('myrg', 'select dname a, dname b from dept');
populate_group(rg_id);
populate_list('mylist', rg_id);
using this i fill my combo box during new form instance trigger
i have created a datablock emp through wizard which can show 10 record.
now
Problem 1
i want to show records on form when user select any dept from combo box.
Problem 2
if i create group from query and in select statement is like this "select dname, dpetno from dept" the record group is created successfully but i am unable to populate_list due to different data type colums in record group how i will populate list so that List items Labels are department name and value is department no
Thanks in advance for persualHi dears all
I have solved this problem my self
1. select dept name form combo box and the data block shows the emp's of concern depat
solution
create a data block of emp table through wizard
create its table view and show 10 records
go to datablock i consider its name "emp" datablock properties
in Where clause condition specify deptno = : my_combo_box;
now go to combo box when item changed event
go_bolck("emp);
execute_query; -
Is there a way on a MAC to create a Combo Box Drop Down list with multiple email addresses?
I'm trying to create a Submit To button on a form that allows me to choose between five different people and their email addresses.
This one form can be sent to five different people, and if I just want to send to one, how do I program that in a combo box?
Can anyone please help??Yes I believe JavaScript may be the answer because I can't seem to get anything else to work.
Currently the email will only need to be sent to one recipient at a time.
I am very unfamiliar with JavaScript and am just starting to dive into it. Would you be able to help me with the coding?
Thank you this sounds very promising! -
How do I make a combo box in LabVIEW 6.1?
I have found reference to the combo box on this site, but it is not in the LabVIEW help for 6.1. Is there a custom VI I can use?
Thanks,
SteveThe combo box was introduced with LabVIEW 7 and is a special type of string control. Prior to 7, everyone used either a ring or enum control. These are all numeric controls and in order to get the string value of the selected item, you have to use the Strings[] property and use the value of control to index the string array. I've attached a 6.1 VI that shows the different controls and how to index the string value to use them in a case statement. For connection to a case statement, it is not required to get the string value - it can be wired directly to the selector.
Attachments:
ring_controls.vi 37 KB -
How to retrieve data in Combo box?
:mad; I need to do a form for delivery order. Just fill some
personal data and order of product. Inside I have some combo box of
product, but I need save the record into txt file (just once time)
then need to retrieve the data from txt file onto combo box. I have
attached the code, I don't know which part got wrong, anybody who
get help me?"roy16" <[email protected]> wrote in message
news:[email protected]...
>
I need to do a form for delivery order. Just fill
some personal data
> and
> order of product. Inside I have some combo box of
product, but I need
> save the
> record into txt file (just once time) then need to
retrieve the data from
> txt
> file onto combo box. I have attached the code, I don't
know which part got
> wrong, anybody who get help me?
>
> Combo box code :
> controls := wcGetControlList()
> listing := "Choose an Item"^Return^"Hot
> Chocholate"^Return^"Tea"^Return^"Coffee"^Return^"Low fat
> Milk"^Return^"Full
> Cream Milk"^Return^"Orange Juice"^Return^"Purified
Water"
> id_list := wcDisplayControl(350, 350, 150, 21,
"ComboBox", "wcS")
> propList := wcGetPropertyList(id_list)
>
>
> Save the data from Combo box list :
> data := wcGetPropertyValue(id_list, "value")^Return
data at this point will be some number between 0 and 7 and
your appended
return.
> WriteExtFile("list2.txt", data)
>
> Read the data from txt :
> data := ReadExtFile("list2.txt")
This will again be a string that contains a number and a
return.
> Convert string to list :
> id_list := [:]
Before, you are populating id_list with a single number that
is the _ID_ of
the winCtrl . Now, you are changing it to an empty property
list. Why?
> AddProperty(data^id_list,controls ,GetLine(data,1))
The first parameter of AddProperty is supposed to be the name
of a variable
which is a property list. As such, you couldn't use a
concatenated
expression there. Even if you could, an Authorware variable
cannot begin
with a number, which data always will in this instance. It
also cannot
contain a return. _And_ the characters "[:]" are not valid
parts of a
variable name either. Next, you're trying to add a property
that looks
something like:
"Button\rCheckBox\rCheckListBox\rColorCombo\rComboBox\rDriveCombo\rEdit..."
While a property list _can_ have strings instead of symbols
as the keys to
the values, this is not documented or officially supported.
Even if it
were, you _cannot_ have a key with returns in it, and I have
no idea why
you'd want to!
Here are the steps you should be using:
1) Create your WinCtrl and store its ID in a regular numeric
value (I'll
call it wcID for convenience)
2) Set its Items property to listing.
3) Check for the existence (FileType) of your file with the
value of the
winCtrl in it. If it exists, set the value property of wcID
to the contents
of the file.
4) You're using wcS as your change event, so set up a
conditional on false
to true with wcS as the condition.
5) Inside that response, write the "value" property (without
the return) of
the wcID control to file.
HTH;
Amy -
How to display data in combo box from xml file.
Hi All,
I have the data in xml file.
<jukebox>
<song>
<title>When the Levee Breaks</title>
<artist>Kansas Joe and Memphis Minnie</artist>
<url>delhi601(www.songs.pk).mp3</url>
</song>
<song>
<title>Better Leave that Stuff Alone</title>
<artist>Will Shade</artist>
<url>delhi601(www.songs.pk).mp3</url>
</song>
<song>
<title>Walk Right In</title>
<artist>Cannon's Jug Stompers</artist>
<url>delhi601(www.songs.pk).mp3</url>
</song>
</jukebox>
and i want to display the only url in combo box list. for that how can load this xml file and how can i show.
Can any one help me.
thanks
Raghu.Raghuvasa,
Get the XML file data into an XML variable in your code, say var jukebox: xml. Then do
combo.dataProvider = jukebox.song.url
or as a shortcut
combo.dataProvider = jukebox.descendants("url")
The latter will pull out elements with tag name url at any depth in the xml structure, so sometimes you have to be careful, but in your case there should be no problem.
Richard -
How to populate the second combo box by depending on the selection in 1st?
I have two combo boxes, both of data in the lists come from the database. The list in the second will be changed when the selection is changed in the first one. I am trying to do query again in the ActionPerform function, unfortunately the list in second one doesn't change.
I am learning Swing now, I really appreciate for any suggestions!
Thankscamickr,
I have another question for the tab pane. Now I have to remove the tab and add tab for updating the tab pane. I wonder if there is other way to do it. I really appreciate your help!
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
public class test_tabpane extends JPanel implements ActionListener {
private JPanel MainPane;
private JComboBox combobox2;
private JTabbedPane TabbedPane;
private JComponent panel1;
private JComponent panel2;
private String [] resources ={"ZZAA", "ZZAB", "ZZAC", "ZZAD"};
private String selected_resource = "";
public test_tabpane() {
MainPane = new JPanel();
MainPane.setOpaque(true);
MainPane.setPreferredSize(new Dimension(600, 70));
MainPane.setBorder(BorderFactory.createRaisedBevelBorder());
combobox2 = new JComboBox(resources);
combobox2.addActionListener(this);
MainPane.add(combobox2);
add(MainPane);
UIManager.put("TabbedPane.tabInsets", new Insets(5,5,5,5));
TabbedPane = new JTabbedPane();
panel1 = makeTextPanel(resources[0]);
TabbedPane.addTab("Language/Notes", panel1);
panel2= makeTextPanel(resources[0]);
TabbedPane.addTab("Relations/Coverage", panel2);
TabbedPane.setPreferredSize(new Dimension(600, 340));
TabbedPane.setFont(new Font("ariel", Font.BOLD, 11));
TabbedPane.setSize(600, 340);
add(TabbedPane);
protected JComponent makeTextPanel(String text) {
JPanel panel = new JPanel(false);
JLabel filler = new JLabel(text);
filler.setHorizontalAlignment(JLabel.CENTER);
// panel.setLayout(new GridLayout(1, 1));
panel.add(filler);
return panel;
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
if ("comboBoxChanged".equals(e.getActionCommand()))
// if ("comboBoxEdited".equals(e.getActionCommand()))
// System.out.println("in action:" + (String)cb.getSelectedItem());
String selected_string = (String)cb.getSelectedItem();
StringTokenizer st = new StringTokenizer(selected_string, "|");
selected_resource = st.nextToken();
updateTabbedPanes(selected_resource);
protected void updateTabbedPanes(String selected_string) {
panel1 = makeTextPanel(selected_string + " in Language/Notes");
int index = TabbedPane.indexOfTab("Language/Notes");
TabbedPane.remove(index);
TabbedPane.insertTab("Language/Notes", null, panel1, "", index);
panel2 = makeTextPanel(selected_string + " in Relations/Coverage");
index = TabbedPane.indexOfTab("Relations/Coverage");
TabbedPane.remove(index);
TabbedPane.insertTab("Relations/Coverage", null, panel2, "", index);
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(false);
//Create and set up the window.
JFrame frame = new JFrame("test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent ContentPane = new test_tabpane();
ContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(ContentPane);
//centers a frame onscreen // it is a problem for wide screen
// frame.setLocationRelativeTo(null);
frame.setLocation(300, 120);
frame.setSize(1024, 768);
frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
//Display the window.
frame.pack();
frame.setVisible(true);
* @param args
* This is main function.
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
} -
Using IO to create a Combo Box
Hello,
I have failed to find any examples on how to do the following, and have not yet figured out how to do it msyelf.
I want to add the entire contents of a file containg a list of people's personal numbers and their names to a combo box that is then added to the frame.
Here is the code: -
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
public class IOCombo extends JFrame
implements ActionListener {
public JButton b1;
public JPanel panel, panel_top, panel_office;
public JFrame frame;
public JLabel officeLabel, personLabel, buttonWorkedLabel;
String OfficeChosen;
String[] Office = {"London", "Paris", "NYC"};
String[] OfficeList;
int[] personalNumber;
public IOCombo() {
frame = new JFrame("IOCombo Test");
panel_top = new JPanel();
panel_office = new JPanel();
panel = new JPanel();
officeLabel = new JLabel("The Office is in ");
personLabel = new JLabel(".");
buttonWorkedLabel = new JLabel(".");
// Exit when the window is closed.
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
b1 = new JButton("Office");
b1.setVerticalTextPosition(AbstractButton.CENTER);
b1.setHorizontalTextPosition(AbstractButton.LEFT);
b1.setMnemonic(KeyEvent.VK_O);
//Listen for actions
b1.addActionListener(this);
//tooltips for buttons
b1.setToolTipText("Choose an Office and a person and then click to edit that Office's Person.");
JComboBox office = new JComboBox(Office);
office.setSelectedIndex(0);
office.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
OfficeChosen = (String)cb.getSelectedItem();
try
whichOffice(OfficeChosen);
catch(IOException ex)
//set layout of all panels and add them to frame.
panel_office.add(officeLabel);
panel_office.add(office);
panel_office.add(personLabel);
panel_top.setLayout(new FlowLayout());
panel_top.add(b1);
panel_top.add(buttonWorkedLabel);
panel.setLayout(new GridLayout(3,0));
panel.add(panel_office);
panel.add(panel_top);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
public void actionPerformed(ActionEvent e) {
String buttonPressed = e.getActionCommand();
if (buttonPressed.equals("Office"))
/**This is just a test, removed the Dialog class to
manipulate the office*/
buttonWorkedLabel.setText("Worked");
else {
/** How do I set-up the combo box using the Office Person chosen from the
file and allocate it to the frame?*/
public void whichOffice(String OfficeChos)throws IOException{
officeLabel.setText("The Office chosen is: " + OfficeChos);
String s, name ="";
int personalNum;
BufferedReader fr = null;
fr = new BufferedReader(new FileReader (OfficeChos+".txt"));
while ((s=fr.readLine()) != null)
StringTokenizer st = new StringTokenizer (s," ");
personalNum = Integer.parseInt(st.nextToken());
st.nextToken();
name = st.nextToken() + " " + st.nextToken();
personLabel.setText(personalNum + " " + name);
/** This method only works if the file contains person
how should I change this to read everyone in?
I want to add the entire contents of personal number and name
of the file to a combo box that is then added to the frame.
public static void main(String[] args) {
IOCombo iocombo = new IOCombo();
The file I have set-up currently that works is called "London.txt" and it contains: -
1 = John Smith
Cheers in advance,
Richard.Hi,
Sorry I cannot get the code you provided to work, not sure if its your code or the ways I have tried to implement it. Please can you check into it and if it works give the completed code.
Reprovided code with formating :-)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
public class IOCombo extends JFrame
implements ActionListener {
public JButton b1;
public JPanel panel, panel_top, panel_office;
public JFrame frame;
public JLabel officeLabel, personLabel, buttonWorkedLabel;
String OfficeChosen;
String[] Office = {"London", "Paris", "NYC"};
String[] OfficeList;
int[] personalNumber;
public IOCombo() {
frame = new JFrame("IOCombo Test");
panel_top = new JPanel();
panel_office = new JPanel();
panel = new JPanel();
officeLabel = new JLabel("The Office is in ");
personLabel = new JLabel(".");
buttonWorkedLabel = new JLabel(".");
// Exit when the window is closed.
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
b1 = new JButton("Office");
b1.setVerticalTextPosition(AbstractButton.CENTER);
b1.setHorizontalTextPosition(AbstractButton.LEFT);
b1.setMnemonic(KeyEvent.VK_O);
//Listen for actions
b1.addActionListener(this);
//tooltips for buttons
b1.setToolTipText("Choose an Office and a person and then click to edit that Office's Person.");
JComboBox office = new JComboBox(Office);
office.setSelectedIndex(0);
office.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
OfficeChosen = (String)cb.getSelectedItem();
try
whichOffice(OfficeChosen);
catch(IOException ex)
//set layout of all panels and add them to frame.
panel_office.add(officeLabel);
panel_office.add(office);
panel_office.add(personLabel);
panel_top.setLayout(new FlowLayout());
panel_top.add(b1);
panel_top.add(buttonWorkedLabel);
panel.setLayout(new GridLayout(3,0));
panel.add(panel_office);
panel.add(panel_top);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
public void actionPerformed(ActionEvent e) {
String buttonPressed = e.getActionCommand();
if (buttonPressed.equals("Office"))
/**This is just a test, removed the Dialog class to
manipulate the office*/
buttonWorkedLabel.setText("Worked");
else {
/** How do I set-up the combo box using the Office Person chosen from the
file and allocate it to the frame?*/
public void whichOffice(String OfficeChos)throws IOException{
officeLabel.setText("The Office chosen is: " + OfficeChos);
String s, name ="";
int personalNum;
BufferedReader fr = null;
fr = new BufferedReader(new FileReader ("c:\\java\\kjc\\set\\"+OfficeChos+".txt"));
while ((s=fr.readLine()) != null)
StringTokenizer st = new StringTokenizer (s," ");
personalNum = Integer.parseInt(st.nextToken());
st.nextToken();
name = st.nextToken() + " " + st.nextToken();
personLabel.setText(personalNum + " " + name);
/** This method only works if the file contains person
how should I change this to read everyone in?
I want to add the entire contents of personal number and name
of the file to a combo box that is then added to the frame.
public static void main(String[] args) {
IOCombo iocombo = new IOCombo();
}Cheers,
Richard
Maybe you are looking for
-
How do I have a picture printed from my iphone
How do I get pictures prints taken with my iphone 4? Would like to have them developped at the Drug Store. Do I need a USB key?
-
Problem with video playback caching to disk
I have a piece of code that opens a netconnection to a FLV file that is essentially identical to the netstream example in the online docs (see below). The video in question is being generated on the fly from a 3rd person app but while it is presented
-
My microphone on the i pad 2 is no longer working any ideas please
My microphone on the i pad 2 no longer works , any ideas ? Please . Thankyou
-
At times I need to convert a page to a pdf form. On IE I have the option to add it to my toolbar so I can convert it with a simple click. I cannot seem to find how I can do that in Mozilla. The attached image shows how it looks in IE (top left of scr
-
How to delete EVERYTHING in iTunes Match? (Playlists & music)
I've downloaded a cd last night and when I drag and dropped it in my iTunes it went mad. I have now hundreds and hundreds of playlists without anything in it, I've tried deleting it one by one but it is a mad job, I don't even know if they acutally d