Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
working with combo box and file chooser
oghenekaro EFEKODO
Ranch Hand
Posts: 56
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
neeed help in identifying the problem with my code.And also,i have been trying to create an application that i can attach a passport using the file chooser but failed.please how do i achieve this fast.thanks in advance.
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TestComboBox extends JFrame{ private int num[]=new int[89]; private JComboBox box[]; public TestComboBox(){ JPanel panel=new JPanel(); panel.setLayout(new BorderLayout()); for(int i=1;i<num.length;i++){ //String s=Integer.parseInt(num[i]); box[i]=(JComboBox)Integer.toString(num[i]); panel.add(box[i]); } add(panel); setVisible(true); setSize(250,250); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String k[]){ new TestComboBox(); } }
Michael Dunn
Ranch Hand
Posts: 4632
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
not sure what you're trying to do with the combobox, but try this
import javax.swing.*; import java.awt.*; import java.awt.event.*; class TestComboBox extends JFrame{ //private int num[]=new int[89]; private int num = 89; //private JComboBox box[]; private JComboBox box = new JComboBox(); public TestComboBox(){ JPanel panel=new JPanel(); //panel.setLayout(new BorderLayout()); //for(int i=1;i<num.length;i++){ for(int i=1; i < num;i++){ //String s=Integer.parseInt(num[i]); //box[i]=(JComboBox)Integer.toString(num[i]); //panel.add(box[i]); box.addItem(String.valueOf(i)); } panel.add(box); add(panel); //setVisible(true); setSize(250,250); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String k[]){ new TestComboBox(); } }
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Panels do not get repainted
changing contents of a combo box
JCombo Box Problem
default JFileChooser to details view Mode
JComboBox oddity
More...