khairiez 0 Report post Posted October 17, 2010 [code] import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.Label.*; class project001 extends JFrame implements ActionListener { private static final int FRAME_WIDTH = 500; private static final int FRAME_HEIGHT = 400; private static final int FRAME_X_ORIGIN = 250; private static final int FRAME_Y_ORIGIN = 300; private JLabel prompt; private JButton enterButton; public static void main(String[] args) { project001 frame = new project001(); frame.setVisible(true); } public project001() { Container contentPane; setSize(FRAME_WIDTH, FRAME_HEIGHT); setResizable(false); setTitle("Student Information System"); setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN); contentPane = getContentPane(); contentPane.setLayout(null); contentPane.setBackground(Color.WHITE); Font f = new Font("Tahoma", Font.BOLD, 28); prompt = new JLabel(); prompt.setText("Student Information System"); prompt.setSize(500, 100); prompt.setHorizontalAlignment(SwingConstants.CENTER); prompt.setFont(f); contentPane.add(prompt); enterButton = new JButton("ENTER"); enterButton.setBounds(200, 300, 80, 30); contentPane.add(enterButton); enterButton.addActionListener(this); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent event) { JButton clickedButton = (JButton) event.getSource(); // ???? } } [/code] stakat nie je aku wat n kalo bleh button enter tu gi kat frame laen.. mcm mane ye coding nye... aku da try google tp xdpt n ade yg x phm.. tolong ye.. Quote Share this post Link to post Share on other sites
Qaromi 0 Report post Posted December 24, 2010 [code]import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.Label.*; class project001 extends JFrame implements ActionListener { private static final int FRAME_WIDTH = 500; private static final int FRAME_HEIGHT = 400; private static final int FRAME_X_ORIGIN = 250; private static final int FRAME_Y_ORIGIN = 300; private JLabel prompt; private JButton enterButton; JFrame test = new JFrame(); // ni untuk ke fram baru, awk leh edit kalao nak public static void main(String[] args) { project001 frame = new project001(); frame.setVisible(true); } public project001() { Container contentPane; setSize(FRAME_WIDTH, FRAME_HEIGHT); setResizable(false); setTitle("Student Information System"); setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN); contentPane = getContentPane(); contentPane.setLayout(null); contentPane.setBackground(Color.WHITE); Font f = new Font("Tahoma", Font.BOLD, 28); prompt = new JLabel(); prompt.setText("Student Information System"); prompt.setSize(500, 100); prompt.setHorizontalAlignment(SwingConstants.CENTER); prompt.setFont(f); contentPane.add(prompt); enterButton = new JButton("ENTER"); enterButton.setBounds(200, 300, 80, 30); contentPane.add(enterButton); enterButton.addActionListener(this); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent event) { test.setSize(650, 300); //size ni nak tentu kan frame yg awak nak masuk tu test.setVisible(true); //memaparkan frame tu } } [/code] sy dah repair skit awk nye coding.. hehe.. cube la ye.. kalao salah bgtau la.. huhu nak bantu ja.. semoga Allah Taala mempermudahkan segala urusan sy, kamu dan semua orang.. Quote Share this post Link to post Share on other sites