I'm learning to design a class diagram for java and this is my first attempt. 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:
I think that your diagram isn't too bad but I noticed some things.