/* below preprocessor command active/inactive*/

//#if DefalultConfiguration                                                                                                                                  
        System.out.println("default");                                                                                                                                       
//#else                                                                                                                                                      
//#     System.out.printls("non default");                                                                                                                   
//#endif                                                                                                                                                     


/* Anagram Game Application */

package com.toy.anagrams.ui;

import com.toy.anagrams.lib.WordLibrary;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.WindowListener; 
import javax.swing.JFrame;

/**
* Javadoc comment for <code>JavaExample</code> class.
* @
author Joes Smith
*/
public class Anagrams extends JFrame { private int privateField; // private field declaration int packagePrivateField; // package private field declaration protected int protectedField; // protected field declaration public int publicField = (100 + 2)*4; // public field declaration private int unusedField; // unused field declaration private Whatever deprecatedField; // deprecated field declaration private String literal = "literal\t\y"; // literal vith valid and invalid escape private int badInt = 1.234567; // bad int private int unusedInt; // unused int private static int staticField; // static field dectaration char ch = 'c'; public static void main(String[] args) { new Anagrams().setVisible(args[0]); } /** Creates new form Anagrams */ public Anagrams() { initComponents(); getRootPane().setDefaultButton(guessButton); scrambledWord.setText(WordLibrary.getScrambledWord(wordIdx)); pack(); guessedWord.requestFocusInWindow(); // Center in the screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); setLocation(new Point((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.width) / 2)); } /** below selected text */ public Anagrams(MyClass superClass ) { initComponents(); superClass.setDefaultButton(guessButton); superClass.setText(WordLibrary.getScrambledWord(wordIdx)); superClass.pack(); guessLabel.setText("Your Guess:"); guessedWord.requestFocusInWindow(); // Center in the screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(new Point((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.width) / 2)); superClass.setLocation(getLocation()); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; mainPanel = new javax.swing.JPanel(); scrambledLabel = new javax.swing.JLabel(); scrambledWord = new javax.swing.JTextField(); guessLabel = new javax.swing.JLabel(); guessedWord = new javax.swing.JTextField(); feedbackLabel = new javax.swing.JLabel(); buttonsPanel = new javax.swing.JPanel(); guessButton = new javax.swing.JButton(); nextTrial = new javax.swing.JButton(); mainMenu = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); aboutMenuItem = new javax.swing.JMenuItem(); exitMenuItem = new javax.swing.JMenuItem(); setTitle("Anagrams"); // below hightlited matching parentheses addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); mainPanel.setLayout(new java.awt.GridBagLayout()); guessLabel.setDisplayedMnemonic('Y'); guessLabel.setLabelFor(guessedWord); guessLabel.setText("Your Guess:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 6); mainPanel.add(guessLabel, gridBagConstraints); fileMenu.add(aboutMenuItem); exitMenuItem.setMnemonic('E'); exitMenuItem.setText("Exit"); exitMenuItem.setToolTipText("Quit Team, Quit!"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); mainMenu.add(fileMenu); setJMenuBar(mainMenu); } private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) { new About(this).setVisible(true); } // below highlighted exit points private void guessedWordActionPerformed(java.awt.event.ActionEvent evt) { if (WordLibrary.isCorrect(wordIdx, guessedWord.getText())){ feedbackLabel.setText("Correct! Try a new word!"); getRootPane().setDefaultButton(nextTrial); exit(0); } else { feedbackLabel.setText("Incorrect! Try again!"); guessedWord.setText(""); return; } guessedWord.requestFocusInWindow(); } private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); } /* below guarded block */ // Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
}

Project Features

About this Project

ui was started in November 2009, is owned by Jiří Kovalský, and has 44 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close