Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Swingproject

mariobeka
mariobeka 


See attached pdf file. Attachments Tags Clarifications

Answers

Magic Marbles with GUI in JAVA

SW_wizard
SW_wizard 



Implementation done as per the specifications. Attachments
MagicMarbles.zip (6 K) Download
Preview
public static int readInt(){ int n = Integer.parseInt(scan.nextLine()); return n; }

Preview
public static void print(){ System.out.print(""); } public static void

Preview
*/ public int getHeight(); /** * The overall state of the game. * * @return The game state. */ public GameState getGameState(); /** * The current number of game points achieved. * * @return The game

Preview
-> useful for testing*/ public FieldImpl(FieldState initialMarbles[][]) { field = new FieldState[initialMarbles.length][initialMarbles[0].length]; for (int i = 0; i < initialMarbles.length; i++) { for (int j = 0; j < initialMarbles[i].length; j++) { field[i][j] = initialMarbles[i][j]; } } state = GameState.RUNNING;

Preview
public enum FieldState { /** The field is occupied with a white marble. */ WHITE{ public String toString(){ return "w"; } }, /** The field is occupied with

Preview
/** The game is terminated, i.e., there are no more two equally colored * marbles next

Preview
= new JTextField(); wfield.setPreferredSize(new Dimension(100,30)); hfield = new JTextField(); hfield.setPreferredSize(new Dimension(100,30)); ok = new JButton("OK"); ok.setPreferredSize(new Dimension(100,30)); cancel = new JButton("Cancel"); cancel.setPreferredSize(new Dimension(100,30)); cancel.addActionListener(new Exit()); ok.addActionListener(new okListener()); panel1.add(wLabel); panel1.add(wfield); panel1.add(hLabel); panel1.add(hfield); panel2.add(ok); p

Preview.jpg (104 K) Download Preview

Screenshots
Screenshot
Purchase Answer

Updated Main.java with additional requirements

SW_wizard
SW_wizard 



Added all 3 features you asked for. Attachments
Main.java (6 K) Download Preview
panel2.setLayout(new FlowLayout()); wLabel = new JLabel("Width: "); hLabel = new JLabel("Height: "); wfield = new JTextField(); wfield.setPreferredSize(new Dimension(100,30)); hfield = new JTextField(); hfield.setPreferredSize(new Dimension(100,30)); ok = new JButton("OK"); ok.setPreferredSize(new Dimension(100,30)); cancel = new JButton("Cancel"); cancel.setPreferredSize(new Dimension(100,30));

Screenshots
Purchase Answer