📄 form1.java
字号:
}*/
}
catch(Exception ep) { MessageBox.show ("Status is not Ok!","Notice:",MessageBox.ICONINFORMATION );}
return false;
}
public void sort() // 对 m_arBook[] 进行排序
{
int i,j;
Book temp;
for(i = 1;i < m_nCount;i++)
{
temp = m_arBook[i];
for(j = i-1;j >= 0;j--)
if(m_arBook[j].getBookIndex ().compareTo (temp.getBookIndex ()) <= 0)
break;
else
m_arBook[j+1] = m_arBook[j];
m_arBook[j+1] = temp;
}
MessageBox.show ("排序完成。","提示:",MessageBox.ICONINFORMATION );
return;
}
public void delete(int nCnt)
{
for( int i = nCnt ; nCnt < m_nCount; i++)
m_arBook[i] = m_arBook[i+1];
m_nCount--;
}
/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
Panel panel1 = new Panel();
Button btnSearch = new Button();
Button btnAdd = new Button();
Edit editCount = new Edit();
Edit editCategory = new Edit();
Edit editName = new Edit();
Edit editIndex = new Edit();
Label labPrice = new Label();
Label labCount = new Label();
Label labCategory = new Label();
Label labName = new Label();
Label labIndex = new Label();
GroupBox groupBox1 = new GroupBox();
Button btnShow = new Button();
Button btnDel = new Button();
Edit editPrice = new Edit();
Label label1 = new Label();
Edit editOpen = new Edit();
Button btnOpen = new Button();
OpenFileDialog openDlg = new OpenFileDialog();
Label labAname = new Label();
Edit editAname = new Edit();
StatusBar statusBar1 = new StatusBar();
StatusBarPanel statusBarPanel1 = new StatusBarPanel();
StatusBarPanel statusBarPanel2 = new StatusBarPanel();
StatusBarPanel statusBarPanel3 = new StatusBarPanel();
StatusBar statusBar = new StatusBar();
StatusBarPanel statusBarPanel4 = new StatusBarPanel();
StatusBarPanel statusBarPanel5 = new StatusBarPanel();
private void initForm()
{
// NOTE: This form is storing resource information in an
// external file. Do not modify the string parameter to any
// resources.getObject() function call. For example, do not
// modify "foo1_location" in the following line of code
// even if the name of the Foo object changes:
// foo1.setLocation((Point)resources.getObject("foo1_location"));
IResourceManager resources = new ResourceManager(this, "Form1");
this.setText("Simple-MainForm");
this.setAutoScaleBaseSize(new Point(6, 12));
this.setClientSize(new Point(592, 473));
this.setIcon((Icon)resources.getObject("this_icon"));
this.setMaximizeBox(false);
panel1.setLocation(new Point(24, 16));
panel1.setSize(new Point(500, 400));
panel1.setTabIndex(0);
panel1.setText("panel1");
btnSearch.setLocation(new Point(190, 360));
btnSearch.setSize(new Point(75, 23));
btnSearch.setTabIndex(1);
btnSearch.setText("查询(&S)");
btnSearch.addOnClick(new EventHandler(this.btnSearch_click));
btnAdd.setLocation(new Point(94, 360));
btnAdd.setSize(new Point(75, 23));
btnAdd.setTabIndex(0);
btnAdd.setText("增加(&A)");
btnAdd.addOnClick(new EventHandler(this.btnAdd_click));
editCount.setLocation(new Point(216, 177));
editCount.setSize(new Point(100, 19));
editCount.setTabIndex(8);
editCount.setText("");
editCategory.setLocation(new Point(216, 104));
editCategory.setSize(new Point(100, 19));
editCategory.setTabIndex(7);
editCategory.setText("");
editName.setLocation(new Point(216, 64));
editName.setSize(new Point(100, 19));
editName.setTabIndex(6);
editName.setText("");
editIndex.setLocation(new Point(216, 24));
editIndex.setSize(new Point(100, 19));
editIndex.setTabIndex(5);
editIndex.setText("");
labPrice.setLocation(new Point(49, 217));
labPrice.setSize(new Point(64, 23));
labPrice.setTabIndex(4);
labPrice.setTabStop(false);
labPrice.setText("价 格:");
labCount.setLocation(new Point(50, 179));
labCount.setSize(new Point(64, 23));
labCount.setTabIndex(3);
labCount.setTabStop(false);
labCount.setText("数 量:");
labCategory.setLocation(new Point(51, 104));
labCategory.setSize(new Point(64, 23));
labCategory.setTabIndex(2);
labCategory.setTabStop(false);
labCategory.setText("类 别:");
labName.setLocation(new Point(52, 64));
labName.setSize(new Point(64, 23));
labName.setTabIndex(1);
labName.setTabStop(false);
labName.setText("书 名:");
labIndex.setLocation(new Point(48, 24));
labIndex.setSize(new Point(64, 23));
labIndex.setTabIndex(0);
labIndex.setTabStop(false);
labIndex.setText("所书号:");
groupBox1.setLocation(new Point(93, 81));
groupBox1.setSize(new Point(360, 256));
groupBox1.setTabIndex(3);
groupBox1.setTabStop(false);
groupBox1.setText("");
btnShow.setLocation(new Point(382, 361));
btnShow.setSize(new Point(75, 23));
btnShow.setTabIndex(7);
btnShow.setText("记录数");
btnShow.addOnClick(new EventHandler(this.btnShow_click));
btnDel.setLocation(new Point(286, 360));
btnDel.setSize(new Point(75, 23));
btnDel.setTabIndex(2);
btnDel.setText("删除(&D)");
btnDel.addOnClick(new EventHandler(this.btnDel_click));
editPrice.setLocation(new Point(216, 217));
editPrice.setSize(new Point(100, 19));
editPrice.setTabIndex(9);
editPrice.setText("");
label1.setLocation(new Point(98, 44));
label1.setSize(new Point(56, 23));
label1.setTabIndex(4);
label1.setTabStop(false);
label1.setText(" 打 开:");
editOpen.setLocation(new Point(181, 41));
editOpen.setSize(new Point(176, 19));
editOpen.setTabIndex(5);
editOpen.setText("A:\\Livrary.mdb");
editOpen.setReadOnly(true);
btnOpen.setLocation(new Point(401, 40));
btnOpen.setSize(new Point(32, 23));
btnOpen.setTabIndex(6);
btnOpen.setText("...");
btnOpen.addOnClick(new EventHandler(this.btnOpen_click));
openDlg.setFileName("*.mdb");
openDlg.setFilter("*.mdb|*.*");
/* @designTimeOnly openDlg.setLocation(new Point(336, 56)); */
labAname.setLocation(new Point(45, 138));
labAname.setSize(new Point(72, 23));
labAname.setTabIndex(10);
labAname.setTabStop(false);
labAname.setText("作者名:");
editAname.setLocation(new Point(216, 136));
editAname.setSize(new Point(100, 19));
editAname.setTabIndex(11);
editAname.setText("");
statusBar1.setBackColor(Color.CONTROL);
statusBar1.setLocation(new Point(0, 473));
statusBar1.setSize(new Point(592, 0));
statusBar1.setTabIndex(1);
statusBar1.setText("statusBar1");
statusBarPanel1.setText("statusBarPanel1");
statusBarPanel2.setText("statusBarPanel2");
statusBarPanel3.setText("statusBarPanel3");
statusBarPanel4.setAutoSize(StatusBarPanelAutoSize.SPRING);
statusBarPanel4.setText("Ready");
statusBarPanel4.setWidth(476);
statusBar.setBackColor(Color.CONTROL);
statusBar.setLocation(new Point(0, 453));
statusBar.setSize(new Point(592, 20));
statusBar.setTabIndex(3);
statusBar.setText("Ready");
statusBar.setShowPanels(true);
statusBar.setPanels(new StatusBarPanel[] {
statusBarPanel4,
statusBarPanel5});
this.setNewControls(new Control[] {
statusBar,
statusBar1,
panel1});
panel1.setNewControls(new Control[] {
btnShow,
btnOpen,
editOpen,
label1,
groupBox1,
btnDel,
btnSearch,
btnAdd});
groupBox1.setNewControls(new Control[] {
editAname,
labAname,
editPrice,
editCount,
editCategory,
editName,
editIndex,
labPrice,
labCount,
labCategory,
labName,
labIndex});
}
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new Form1());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -