/* * Copyright (C) 2014 Vinu K.N * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.domainmath.gui.dialog; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; /** * * @author Vinu K.N */ public class Info extends javax.swing.JDialog { /** * Creates new form ExceptionDialog */ private String secondTitle; public Info(JComponent parent, boolean modal,String secondTitle,String text) { initComponents(); this.jTextArea1.setText(secondTitle); setLocationRelativeTo(parent); setModal(modal); setIconImage(icon); } public Info(JComponent parent, boolean modal) { initComponents(); this.label.setText(secondTitle); setLocationRelativeTo(parent); setModal(modal); setIconImage(icon); } public Info(JFrame parent,boolean modal) { super(parent,modal); initComponents(); setLocationRelativeTo(parent); setModal(modal); setIconImage(icon); } public Info(JComponent parent) { initComponents(); this.label.setText(secondTitle); setLocationRelativeTo(parent); setModal(true); setIconImage(icon); } public Info(JFrame parent) { super(parent,true); initComponents(); setLocationRelativeTo(parent); setIconImage(icon); } public Info(JFrame parent,String secondTitle) { super(parent,true); initComponents(); setLocationRelativeTo(parent); this.jTextArea1.setText(secondTitle); setIconImage(icon); setVisible(true); } public Info(JFrame parent,String title,String secondTitle) { super(parent,true); initComponents(); setLocationRelativeTo(parent); this.jTextArea1.setText(secondTitle); this.setTitle(title); setIconImage(icon); setVisible(true); } public Info(boolean modal) { initComponents(); setLocationRelativeTo(null); setModal(modal); setIconImage(icon); } public Info(String title,String secondTitle,boolean modal) { initComponents(); setLocationRelativeTo(null); setModal(modal); setIconImage(icon); this.jTextArea1.setText(secondTitle); this.setTitle(title); setIconImage(icon); setVisible(true); } public void addButton(JButton b){ this.buttonPanel.add(b); this.buttonPanel.revalidate(); } public String getSecondTitle() { return secondTitle; } public void setSecondTitle(String secondTitle) { this.secondTitle = secondTitle; this.jTextArea1.setText(secondTitle); } /** * 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">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); label = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); buttonPanel = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("DomainMath IDE"); setIconImage(null); jPanel1.setBackground(new java.awt.Color(102, 102, 255)); label.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N label.setForeground(new java.awt.Color(255, 255, 255)); label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/dialogs/resources/appbar.information.png"))); // NOI18N jScrollPane1.setBorder(null); jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); jTextArea1.setEditable(false); jTextArea1.setBackground(new java.awt.Color(102, 102, 255)); jTextArea1.setColumns(20); jTextArea1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N jTextArea1.setForeground(new java.awt.Color(255, 255, 255)); jTextArea1.setLineWrap(true); jTextArea1.setRows(5); jTextArea1.setWrapStyleWord(true); jTextArea1.setFocusable(false); jTextArea1.setSelectionColor(new java.awt.Color(255, 155, 0)); jScrollPane1.setViewportView(jTextArea1); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(label) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(label, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addContainerGap()) ); buttonPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 10, 5, 10)); buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); okButton.setMnemonic('K'); okButton.setText("OK"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); buttonPanel.add(okButton); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, 0) .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed dispose(); }//GEN-LAST:event_okButtonActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Info dialog = new Info(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); } }); } public java.net.URL imgURL = getClass().getResource("/org/domainmath/gui/dialogs/resources/DomainMath.png"); public Image icon = Toolkit.getDefaultToolkit().getImage(imgURL); // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel buttonPanel; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; private javax.swing.JLabel label; private javax.swing.JButton okButton; // End of variables declaration//GEN-END:variables }