[英]Java Class Diagram
I'm learning to design a class diagram for java and this is my first attempt. 我正在学习为Java设计类图,这是我的第一次尝试。 Could you please tell me if it's okay.
你能告诉我是否可以。
Here's the source code 这是源代码
public class DiceRoll1 extends JFrame implements ActionListener {
private JTextField txtNotation;
private JButton btRoll, btShuffle;
private List<Integer> dealtCard;
private History history;
public DiceRoll1() {
initComponents();
dealtCard = new ArrayList<>();
history = new History();
}
public void initComponents() {
//designing the userform
setSize(400, 500);
setLayout(new FlowLayout());
setTitle("Dice Roll");
txtNotation = new JTextField("2d6");
btRoll = new JButton("Roll");
btShuffle = new JButton("Shuffle");
txtNotation.setColumns(20);
getContentPane().add(txtNotation);
getContentPane().add(btRoll);
getContentPane().add(btShuffle);
btRoll.addActionListener(this);
btShuffle.addActionListener(this);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new DiceRoll().setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
JButton source = (JButton) e.getSource();
if (source.equals(btRoll)) {
} else if (source.equals(btShuffle)) {
}
}
public void displayOutput(String message) {
System.out.println(message);
}
}
Here's the diagram that i have drawn using Visio professional: 这是我使用Visio Professional绘制的图表:
I think that your diagram isn't too bad but I noticed some things. 我认为您的图表还不错,但是我注意到了一些事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.