📄 paintbox.java
字号:
/*
* PaintBox.java
*
* Created on 2007年4月27日, 下午9:37
*/
package paintboxs;
/**
*
* @author kiki
*/
public class PaintBox extends javax.swing.JFrame {
/** Creates new form PaintBox */
public PaintBox() {
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.
*/
// <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
private void initComponents() {
jPopupMenu1 = new javax.swing.JPopupMenu();
jPanel1 = new javax.swing.JPanel();
Select = new javax.swing.JButton();
Line = new javax.swing.JButton();
Oval = new javax.swing.JButton();
Rect = new javax.swing.JButton();
Poly = new javax.swing.JButton();
Stroke = new javax.swing.JButton();
Fill = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("PaintBox");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 582, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 295, Short.MAX_VALUE)
);
Select.setText("Select");
Select.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SelectActionPerformed(evt);
}
});
Line.setText("Line");
Line.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
LineActionPerformed(evt);
}
});
Oval.setText("Oval");
Rect.setText("Rect");
Poly.setText("Poly");
Stroke.setText("Stroke");
Fill.setText("Fill");
Fill.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FillActionPerformed(evt);
}
});
jMenu1.setText("Menu");
jMenu1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu1ActionPerformed(evt);
}
});
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
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)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(Select)
.addGap(16, 16, 16)
.addComponent(Line)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Oval)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Rect)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Poly)
.addGap(60, 60, 60)
.addComponent(Stroke)
.addGap(23, 23, 23)
.addComponent(Fill)
.addContainerGap(27, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Select)
.addComponent(Line)
.addComponent(Oval)
.addComponent(Rect)
.addComponent(Poly)
.addComponent(Stroke)
.addComponent(Fill))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void FillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FillActionPerformed
// TODO 将在此处添加您的处理代码:
}//GEN-LAST:event_FillActionPerformed
private void LineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LineActionPerformed
// TODO 将在此处添加您的处理代码:
}//GEN-LAST:event_LineActionPerformed
private void SelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SelectActionPerformed
PaintArea.Select();
// TODO 将在此处添加您的处理代码:
}//GEN-LAST:event_SelectActionPerformed
private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
// TODO 将在此处添加您的处理代码:
}//GEN-LAST:event_jMenu1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PaintBox().setVisible(true);
}
});
}
// 变量声明 - 不进行修改//GEN-BEGIN:variables
private javax.swing.JButton Fill;
private javax.swing.JButton Line;
private javax.swing.JButton Oval;
private javax.swing.JButton Poly;
private javax.swing.JButton Rect;
private javax.swing.JButton Select;
private javax.swing.JButton Stroke;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPopupMenu jPopupMenu1;
// 变量声明结束//GEN-END:variables
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -