我似乎无法移动我带入课堂的任何对象,当我设置界限时,其他类似乎功能正常,但不是这个。
我想知道为什么它在工作和功能上都不像我的其他课程。
有些界限是极端的,因为我确保我能注意到是否有任何物体在移动;他们不是。
package student.information.in.java;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.sql.*;
public class CreatedBy extends JFrame {
JButton btnJoelHogg, btnAndrewCameron, btnConorElliman, btnTiarnanByrne, btnproject;
JLabel lblJoel, lblAndrew, lblConor, lblTiarnan, lbl_title, lbl_Info;
public CreatedBy() {
super("Project team and information");
setLayout(null);
lbl_title = new JLabel("Information about the system & its creators", JLabel.CENTER);
add(lbl_title);
lbl_title.setBounds(200, 200, 200, 200);
lbl_title.setFont(new Font("Calibri", Font.PLAIN, 30));
lbl_title.setForeground(Color.BLACK);
lblJoel = new JLabel("Joel Hogg");
add(lblJoel);
lblJoel.setBounds(30, 140, 200, 30);
lblJoel.setFont(new Font("Calibri", Font.PLAIN, 14));
lblJoel.setForeground(Color.BLACK);
btnJoelHogg = new JButton("About Joel");
btnJoelHogg.setFont(new Font("Calibri", Font.PLAIN, 14));
btnJoelHogg.setBackground(Color.LIGHT_GRAY);
btnJoelHogg.setForeground(Color.BLACK);
lblAndrew = new JLabel("Andrew Cameron");
add(lblAndrew);
lblAndrew.setBounds(80, 50, 400, 30);
lblAndrew.setFont(new Font("Calibri", Font.PLAIN, 14));
lblAndrew.setForeground(Color.BLACK);
btnAndrewCameron = new JButton("About Andrew");
btnAndrewCameron.setFont(new Font("Calibri", Font.PLAIN, 14));
btnAndrewCameron.setBackground(Color.LIGHT_GRAY);
btnAndrewCameron.setForeground(Color.BLACK);
lblJoel = new JLabel("Conor Elliman");
add(lblJoel);
lblJoel.setBounds(20, 540, 170, 380);
lblJoel.setFont(new Font("Calibri", Font.PLAIN, 14));
lblJoel.setForeground(Color.BLACK);
btnConorElliman = new JButton("About Conor");
btnConorElliman.setFont(new Font("Calibri", Font.PLAIN, 14));
btnConorElliman.setBackground(Color.LIGHT_GRAY);
btnConorElliman.setForeground(Color.BLACK);
lblTiarnan = new JLabel("Tiarnán");
add(lblTiarnan);
lblTiarnan.setBounds(202, 506, 170, 30);
lblTiarnan.setFont(new Font("Calibri", Font.PLAIN, 14));
lblTiarnan.setForeground(Color.BLACK);
btnTiarnanByrne = new JButton("About Tiarnán");
btnTiarnanByrne.setFont(new Font("Calibri", Font.PLAIN, 14));
btnTiarnanByrne.setBackground(Color.LIGHT_GRAY);
btnTiarnanByrne.setForeground(Color.BLACK);
Container c = getContentPane();
FlowLayout fl = new FlowLayout(FlowLayout.LEFT);
c.setLayout(fl);
c.add(btnJoelHogg);
c.add(btnAndrewCameron);
c.add(btnConorElliman);
c.add(btnTiarnanByrne);
ButtonHandler handler = new ButtonHandler();
btnJoelHogg.addActionListener(handler);
btnAndrewCameron.addActionListener(handler);
btnConorElliman.addActionListener(handler);
btnTiarnanByrne.addActionListener(handler);
setSize(600, 400);
show();
}
public static void main(String[] args) {
// Make frame
CreatedBy f = new CreatedBy();
f.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Exit via windowClosing.");
System.exit(0);
}
}
);
} // end of main
// inner class for button event handling
private class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnJoelHogg) {
System.out.println(
"Joel Hogg button pressed");
}
if (e.getSource() == btnAndrewCameron) {
System.out.println(
"Andrew Cameron button pressed");
}
if (e.getSource() == btnTiarnanByrne) {
System.out.println("Tiarnan Byrne button pressed");
}
if (e.getSource() == btnConorElliman) {
System.out.println("Conor Elliman button pressed");
}
}
} // end of inner class
} // end of outer class