Welcome, Guest. Please login or register.
Did you miss your activation email?
Pages: [1]   Go Down
  Print  
Author Topic: hi.. i have a problem with my gui program  (Read 811 times)
0 Members and 1 Guest are viewing this topic.
G. Ritardo
Member
*
*

Reputation: 0
Offline Offline
Posts: 53
Referrals: 0

Awards
« on: May 21, 2009, 08:15:07 AM »

http://i615.photobucket.com/albums/tt237/teoceper/untitled-2.jpg
hi.. i have a problem with my gui program


there are checked number at there

number 1 : how can i suite the JTextField into JPanel??

so the result is like this
http://i615.photobucket.com/albums/tt237/teoceper/1.jpg
hi.. i have a problem with my gui program


number 2 : how can i put the form lower?? i've try this many time, but i ca't solve it

so the result like this
http://i615.photobucket.com/albums/tt237/teoceper/2.jpg
hi.. i have a problem with my gui program


number 3 : same like number 1, how can i suite the JButton into its JPanel

so the result like this
http://i615.photobucket.com/albums/tt237/teoceper/3.jpg
hi.. i have a problem with my gui program


and here is my code

Code
GeSHi (java):
  1. import java.awt.*;
  2.  
  3. import javax.swing.*;
  4. import javax.swing.border.Border;
  5.  
  6. public class h3latihan1 extends JFrame
  7. {
  8. JPanel north = new JPanel();
  9. JLabel utara = new JLabel("Form Check List Kondisi Ruangan Lab Software");
  10.  
  11. JPanel east = new JPanel(new GridLayout(4,4));
  12. JButton timur[] = new JButton[17];
  13.  
  14. JPanel west = new JPanel(new GridLayout(4,4));
  15. JButton barat[] = new JButton[17];
  16.  
  17. JPanel south = new JPanel(new FlowLayout());
  18. JPanel south4 = new JPanel(new FlowLayout());
  19. JPanel south2 = new JPanel(new GridLayout(3,3));
  20. JPanel south3 = new JPanel(new GridLayout(3,3));
  21. JPanel south5 = new JPanel();
  22. private String tf[] = {"Nama :","Ruangan :","Password :","Wilayah :","Bagian :","Kerusakan :"};
  23. private String bt[] = {"Submit","Reset","Exit"};
  24. JButton selatan3[] = new JButton[3];
  25. JLabel selatan[] = new JLabel[6];
  26. JTextField selatan1[] = new JTextField[6];
  27. JPasswordField selatan2 = new JPasswordField();
  28.  
  29. JPanel central1 = new JPanel();
  30. JPanel central2 = new JPanel(new FlowLayout());
  31. JPanel central3 = new JPanel(new GridLayout());
  32. JPanel central = new JPanel(new GridLayout());
  33. JTextField tengah = new JTextField();
  34. JTextField tengah2 = new JTextField();
  35.  
  36. //Border emptyBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
  37.  
  38. h3latihan1()
  39. {
  40. north.add(utara);
  41. utara.setForeground(Color.WHITE);
  42. north.setBackground(Color.BLACK);
  43. utara.setFont(new Font("Showcard Gothic",Font.BOLD,25));
  44. add(north,"North");
  45.  
  46. for(int i=1;i<=16;i++)
  47. {
  48. timur[i]=new JButton(""+i);
  49. timur[i].setForeground(Color.WHITE);
  50. timur[i].setBackground(Color.BLACK);
  51. east.add(timur[i]);
  52. }
  53. east.setPreferredSize(new Dimension(200,200));
  54. add(east,"East");
  55.  
  56. for(int i=1;i<=16;i++)
  57. {
  58. barat[i]=new JButton(""+i);
  59. barat[i].setForeground(Color.WHITE);
  60. barat[i].setBackground(Color.BLACK);
  61. west.add(barat[i]);
  62. }
  63. west.setPreferredSize(new Dimension(200,200));
  64. add(west,"West");
  65.  
  66. for(int i=0;i<6;i++)
  67. {
  68. south3.add(selatan[i] = new JLabel(tf[i]));
  69. if(i==2)
  70. {
  71. south3.add(selatan2 = new JPasswordField());
  72. }
  73. else
  74. {
  75. south3.add(selatan1[i] = new JTextField());
  76. }
  77. south.add(south3);
  78. south2.add(south);
  79. }
  80. for(int i=0;i<3;i++)
  81. {
  82. south4.add(selatan3[i]=new JButton(bt[i]));
  83. south2.add(south4);
  84. }
  85. south2.setPreferredSize(new Dimension (300,200));
  86. south5.add(south2);
  87. south5.setBackground(Color.BLACK);
  88.  
  89. central3.setPreferredSize(new Dimension(150,200));
  90. //central3.setBorder(emptyBorder);
  91. tengah2.setPreferredSize(new Dimension(100,200));
  92. central3.add(tengah2=new JTextField());
  93. central.setPreferredSize(new Dimension(150,200));
  94. central.add(tengah=new JTextField());
  95. central2.add(central3);
  96. central2.add(central);
  97. central1.setBackground(Color.BLUE);
  98. central1.add(central2);
  99.  
  100. JFrame f= new JFrame("08-2 Express Our Ability");
  101. Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
  102. f.setBounds(center.x - 900 / 2, center.y - 500 / 2,900,500);
  103. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  104. Container cp = f.getContentPane();
  105. cp.add(north,BorderLayout.NORTH);
  106. cp.add(east,BorderLayout.EAST);
  107. cp.add(west,BorderLayout.WEST);
  108. cp.add(south5,BorderLayout.SOUTH);
  109. cp.add(central1,BorderLayout.CENTER);
  110. //f.pack();
  111. f.setVisible(true);
  112. }
  113.  
  114. public static void main(String[]args)
  115. {
  116. new h3latihan1();
  117. }
  118. }
Created by GeSHI 1.0.7.20


Logged

Founder of www.Retardation-Foundation.com :: A community for retarded people!? Powered by admin Gaylord Ritardo.
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here