/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* ReplInfoFrame.java
*
* Created on Jan 27, 2009, 4:56:47 PM
*/
package org.enclojure.ide.repl;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
/**
*
* @author nsinghal
*/
public class ReplInfoFrame extends javax.swing.JFrame {
/** Creates new form ReplInfoFrame */
private ReplInfoFrame() {
initComponents();
}
private void setMessage(String title, String msg)
{
this.setTitle(title);
msgBox.setText(msg);
}
static public Point getCenteredCorner(Component c)
{
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
return new Point(
(int)((dim.getWidth() - c.getWidth()) / 2),
(int)((dim.getHeight() - c.getHeight()) / 2)
);
}
public static ReplInfoFrame _replInfoFrame = null;
public static void Show(String title, String msg)
{
if(_replInfoFrame == null) _replInfoFrame = new ReplInfoFrame();
_replInfoFrame.setLocation(getCenteredCorner(_replInfoFrame));
_replInfoFrame.setMessage(title, msg);
_replInfoFrame.setVisible(true);
}
/** 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() {
jScrollPane1 = new javax.swing.JScrollPane();
msgBox = new javax.swing.JTextArea();
okButton = new javax.swing.JButton();
setAlwaysOnTop(true);
msgBox.setColumns(20);
msgBox.setRows(5);
jScrollPane1.setViewportView(msgBox);
okButton.setText("OK");
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 690, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(okButton)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(okButton)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
this.dispose();
}//GEN-LAST:event_okButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea msgBox;
private javax.swing.JButton okButton;
// End of variables declaration//GEN-END:variables
}