package nbtool.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import nbtool.gui.utilitypanes.UtilityParent;
public class UtilityPanel extends JPanel {
private static final long serialVersionUID = 1L;
private UtilityParent util;
public UtilityPanel(UtilityParent up) {
initComponents();
util = up;
char memn = Character.toUpperCase(up.preferredMemnonic());
if (memn > 0) {
this.memLabel.setText("" + memn);
} else {
this.memLabel.setText("n/a");
}
this.purposeLabel.setText(up.purpose());
this.showButton.setText(up.getClass().getSimpleName());
this.showButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
util.getDisplay().setVisible(true);
}
});
// this.setPreferredSize(new Dimension(Integer.MAX_VALUE, 59));
this.setMaximumSize(this.getPreferredSize());
}
/**
* 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() {
purposeLabel = new javax.swing.JLabel();
memLabel = new javax.swing.JLabel();
showButton = new javax.swing.JButton();
setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
purposeLabel.setText("aesrdtfghkjlhgyuftrd");
memLabel.setFont(new java.awt.Font("Lucida Grande", 3, 14)); // NOI18N
memLabel.setText("m");
showButton.setText("jButton1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(purposeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(memLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(showButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(purposeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(showButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(memLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JLabel memLabel;
private javax.swing.JLabel purposeLabel;
private javax.swing.JButton showButton;
// End of variables declaration
}