Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Frame.java
- import java.awt.Color;
- import java.util.Scanner;
- import javax.swing.*;
- import java.awt.Event.*;
- import java.io.*;
- import javax.swing.text.BadLocationException;
- import javax.swing.text.DefaultHighlighter;
- import javax.swing.text.Document;
- import javax.swing.text.Highlighter;
- import javax.swing.text.SimpleAttributeSet;
- import javax.swing.text.StyleConstants;
- import javax.swing.undo.UndoManager;
- public class Frame extends javax.swing.JFrame {
- /**
- * Creates new form Frame
- */
- UndoManager um;
- private int pos;
- public Frame() {
- initComponents();
- um = new UndoManager();
- jTextPane1.getDocument().addUndoableEditListener(um);
- }
- /**
- * 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.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jMenuItem12 = new javax.swing.JMenuItem();
- jScrollPane2 = new javax.swing.JScrollPane();
- jTextPane1 = new javax.swing.JTextPane();
- jMenuBar1 = new javax.swing.JMenuBar();
- jMenu1 = new javax.swing.JMenu();
- jMenuItem1 = new javax.swing.JMenuItem();
- jMenuItem2 = new javax.swing.JMenuItem();
- jSeparator2 = new javax.swing.JPopupMenu.Separator();
- jMenuItem3 = new javax.swing.JMenuItem();
- jMenuItem4 = new javax.swing.JMenuItem();
- jSeparator1 = new javax.swing.JPopupMenu.Separator();
- jMenuItem5 = new javax.swing.JMenuItem();
- jMenu2 = new javax.swing.JMenu();
- jMenuItem6 = new javax.swing.JMenuItem();
- jMenuItem7 = new javax.swing.JMenuItem();
- jSeparator3 = new javax.swing.JPopupMenu.Separator();
- jMenuItem8 = new javax.swing.JMenuItem();
- jMenuItem9 = new javax.swing.JMenuItem();
- jMenuItem10 = new javax.swing.JMenuItem();
- jSeparator4 = new javax.swing.JPopupMenu.Separator();
- jMenuItem11 = new javax.swing.JMenuItem();
- jMenu4 = new javax.swing.JMenu();
- jMenuItem14 = new javax.swing.JMenuItem();
- jMenu3 = new javax.swing.JMenu();
- jMenuItem13 = new javax.swing.JMenuItem();
- jMenuItem12.setText("jMenuItem12");
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- jScrollPane2.setViewportView(jTextPane1);
- jMenu1.setText("Datoteka");
- jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem1.setText("Novi");
- jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem1ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem1);
- jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem2.setText("Otvori");
- jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem2ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem2);
- jMenu1.add(jSeparator2);
- jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem3.setText("Spremi");
- jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem3ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem3);
- jMenuItem4.setText("Spremi kao");
- jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem4ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem4);
- jMenu1.add(jSeparator1);
- jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem5.setText("Izađi");
- jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem5ActionPerformed(evt);
- }
- });
- jMenu1.add(jMenuItem5);
- jMenuBar1.add(jMenu1);
- jMenu2.setText("Uredi");
- jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem6.setText("Nazad");
- jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem6ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem6);
- jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem7.setText("Naprijed");
- jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem7ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem7);
- jMenu2.add(jSeparator3);
- jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem8.setText("Izreži");
- jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem8ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem8);
- jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem9.setText("Kopiraj");
- jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem9ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem9);
- jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem10.setText("Zalijepi");
- jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem10ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem10);
- jMenu2.add(jSeparator4);
- jMenuItem11.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
- jMenuItem11.setText("Selektuj sve");
- jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem11ActionPerformed(evt);
- }
- });
- jMenu2.add(jMenuItem11);
- jMenuBar1.add(jMenu2);
- jMenu4.setText("Pretraga");
- jMenuItem14.setText("Traži");
- jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem14ActionPerformed(evt);
- }
- });
- jMenu4.add(jMenuItem14);
- jMenuBar1.add(jMenu4);
- jMenu3.setText("Pomoć");
- jMenuItem13.setText("O programu");
- jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jMenuItem13ActionPerformed(evt);
- }
- });
- jMenu3.add(jMenuItem13);
- jMenuBar1.add(jMenu3);
- setJMenuBar(jMenuBar1);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE)
- );
- pack();
- }// </editor-fold>
- Boolean spremljeno = true;
- BufferedWriter datoteka;
- JFileChooser spremi;
- JFileChooser otvori;
- private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
- if(spremljeno == true){
- jTextPane1.setText("");
- spremljeno = false;
- }
- if(spremljeno == false){
- int opcija = JOptionPane.showConfirmDialog(null,
- "Datoteka nije spremljena, želite li nastaviti?", "Datoteka nije spremljena!",
- JOptionPane.YES_NO_OPTION);
- if(opcija==JOptionPane.YES_OPTION){
- jTextPane1.setText("");
- spremljeno = false;
- }
- }
- }
- private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
- otvori = new JFileChooser();
- int opcija = otvori.showOpenDialog(this);
- izlaz:
- if(opcija == JFileChooser.APPROVE_OPTION){
- if(spremljeno == true){
- jTextPane1.setText("");
- spremljeno = false;
- }
- if(spremljeno == false){
- int opcija1 = JOptionPane.showConfirmDialog(null,
- "Datoteka nije spremljena, želite li nastaviti?", "Datoteka nije spremljena!",
- JOptionPane.YES_NO_OPTION);
- if(opcija1==JOptionPane.YES_OPTION){
- jTextPane1.setText("");
- spremljeno = false;
- }
- else{
- break izlaz;
- }
- }
- try{
- Scanner ulaz = new Scanner(new FileReader(otvori.getSelectedFile().getPath()));
- while(ulaz.hasNext()){
- jTextPane1.setText(ulaz.nextLine()+"\n");
- }
- }
- catch(Exception e){
- System.out.println(e.getMessage());
- }
- }
- }
- private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {
- this.dispose();
- }
- private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {
- spremi = new JFileChooser();
- int opcija = spremi.showSaveDialog(this);
- try{
- datoteka = new BufferedWriter(new FileWriter(spremi.getSelectedFile().getAbsoluteFile()));
- String tekst = jTextPane1.getText();
- datoteka.write(tekst);
- datoteka.close();
- spremljeno = true;
- }
- catch(Exception e){
- System.out.println(e.getMessage());
- }
- }
- private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
- if(datoteka == null){
- jMenuItem4ActionPerformed(evt);
- }
- else {
- try{
- datoteka = new BufferedWriter(new FileWriter(spremi.getSelectedFile().getAbsoluteFile()));
- String tekst = jTextPane1.getText();
- datoteka.write(tekst);
- datoteka.close();
- spremljeno = true;}
- catch(Exception e){
- System.out.println(e.getMessage());
- }
- }
- }
- private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {
- if(um.canUndo()){
- um.undo();
- }
- }
- private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {
- jTextPane1.copy();
- }
- private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {
- jTextPane1.paste();
- }
- private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {
- jTextPane1.selectAll();
- }
- private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {
- jTextPane1.cut();
- }
- private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {
- if(um.canRedo()){
- um.redo();
- }
- }
- private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {
- About a = new About();
- a.show();
- }
- public void traziJedan(String rijec){
- try{
- Highlighter h = jTextPane1.getHighlighter();
- h.removeAllHighlights();
- String text = jTextPane1.getText();
- String pattern = rijec;
- int pos = 0;
- while ((pos = text.indexOf(pattern, pos)) >= 0) {
- h.addHighlight(pos, pos + pattern.length(), DefaultHighlighter.DefaultPainter);
- pos += pattern.length();
- System.out.println(rijec);
- }
- }
- catch(BadLocationException e){}
- }
- private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {
- Trazi t = new Trazi();
- t.show();
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Metal".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(Frame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new Frame().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JMenu jMenu1;
- private javax.swing.JMenu jMenu2;
- private javax.swing.JMenu jMenu3;
- private javax.swing.JMenu jMenu4;
- private javax.swing.JMenuBar jMenuBar1;
- private javax.swing.JMenuItem jMenuItem1;
- private javax.swing.JMenuItem jMenuItem10;
- private javax.swing.JMenuItem jMenuItem11;
- private javax.swing.JMenuItem jMenuItem12;
- private javax.swing.JMenuItem jMenuItem13;
- private javax.swing.JMenuItem jMenuItem14;
- private javax.swing.JMenuItem jMenuItem2;
- private javax.swing.JMenuItem jMenuItem3;
- private javax.swing.JMenuItem jMenuItem4;
- private javax.swing.JMenuItem jMenuItem5;
- private javax.swing.JMenuItem jMenuItem6;
- private javax.swing.JMenuItem jMenuItem7;
- private javax.swing.JMenuItem jMenuItem8;
- private javax.swing.JMenuItem jMenuItem9;
- private javax.swing.JScrollPane jScrollPane2;
- private javax.swing.JPopupMenu.Separator jSeparator1;
- private javax.swing.JPopupMenu.Separator jSeparator2;
- private javax.swing.JPopupMenu.Separator jSeparator3;
- private javax.swing.JPopupMenu.Separator jSeparator4;
- private javax.swing.JTextPane jTextPane1;
- // End of variables declaration
- }
- // About.java
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author alen
- */
- public class About extends javax.swing.JFrame {
- /**
- * Creates new form About
- */
- public About() {
- initComponents();
- }
- /**
- * 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.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jButton1 = new javax.swing.JButton();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- jLabel1.setFont(new java.awt.Font("Droid Sans", 1, 24)); // NOI18N
- jLabel1.setText("JavaNotepad v1.3");
- jLabel2.setText("Autor: Alen Mašić <alenn.masic@gmail.com>");
- jButton1.setText("Zatvori");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(98, 98, 98)
- .addComponent(jLabel1))
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel2)))
- .addGap(0, 75, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(jButton1)))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(29, 29, 29)
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jButton1)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
- pack();
- }// </editor-fold>
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- this.dispose();
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new About().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JButton jButton1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- // End of variables declaration
- }
- // Trazi.java
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author alen
- */
- public class Trazi extends javax.swing.JFrame {
- /**
- * Creates new form Trazi
- */
- public Trazi() {
- initComponents();
- }
- /**
- * 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.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jTextField1 = new javax.swing.JTextField();
- jTextField2 = new javax.swing.JTextField();
- jButton1 = new javax.swing.JButton();
- jButton2 = new javax.swing.JButton();
- jButton3 = new javax.swing.JButton();
- jButton4 = new javax.swing.JButton();
- jButton5 = new javax.swing.JButton();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- jButton1.setText("Traži");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- jButton2.setText("Traži sve");
- jButton3.setText("Zamijeni");
- jButton4.setText("Zamijeni sve");
- jButton5.setText("Zatvori");
- jLabel1.setText("Traži tekst:");
- jLabel2.setText("Zamijeni sa:");
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton4)
- .addGap(0, 0, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel1)
- .addComponent(jLabel2))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(jButton5))
- .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING))))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel2))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jButton1)
- .addComponent(jButton2)
- .addComponent(jButton3)
- .addComponent(jButton4))
- .addGap(26, 26, 26)
- .addComponent(jButton5)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
- pack();
- }// </editor-fold>
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- Frame f = new Frame();
- f.traziJedan(jTextField1.getText());
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(Trazi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(Trazi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(Trazi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(Trazi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new Trazi().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JButton jButton1;
- private javax.swing.JButton jButton2;
- private javax.swing.JButton jButton3;
- private javax.swing.JButton jButton4;
- private javax.swing.JButton jButton5;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JTextField jTextField1;
- private javax.swing.JTextField jTextField2;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement