Advertisement
Guest User

Test JComboBox

a guest
Feb 16th, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. package TestComboBox;
  2.  
  3. import java.awt.Color;
  4.  
  5. import javax.swing.*;
  6.  
  7. public class TestComboBox extends JFrame{
  8.  
  9. public TestComboBox() {
  10. this.setSize(300,300);
  11. this.setLayout(null);
  12. this.setVisible(true);
  13. }
  14.  
  15. public static void main(String[] args) {
  16. // TODO Auto-generated method stub
  17. JFrame myFrame = new TestComboBox();
  18.  
  19. String[] testStr= {"small", "meduim", "large"};
  20.  
  21. JComboBox testBox = new JComboBox(testStr);
  22. testBox.setBounds(100, 100, 100, 30);
  23. testBox.setBackground(Color.WHITE);
  24. myFrame.add(testBox);
  25.  
  26.  
  27. }
  28.  
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement