📄 main.java
字号:
color = Color.gray; desktop.setBackground( color ); menuBar.setBackground( color); menu.setBackground( color); add.setBackground( color); rtn.setBackground( color); report.setBackground( color); help.setBackground( color); bk_loan.setBackground(color); desktop.repaint(); menuBar.repaint(); menu.repaint(); add.repaint(); rtn.repaint(); report.repaint(); help.repaint(); bk_loan.repaint(); bk_mast.setBackground(color); bk_ret.setBackground(color); j_master.setBackground(color); j_loan.setBackground(color); j_ret.setBackground(color); v_master.setBackground(color); v_loan.setBackground(color); v_ret.setBackground(color); pt_mast.setBackground(color); menuItem3.setBackground(color); menuItem6.setBackground(color); menuItem5.setBackground(color); returnItem1.setBackground(color); returnItem2.setBackground(color); returnItem3.setBackground(color); returnItem4.setBackground(color); reportItem1.setBackground(color); reportItem2.setBackground(color); menuItemhelp1.setBackground(color); menuItemhelp2.setBackground(color); menuItemhelp3.setBackground(color); menuBar.setBackground(color); menu.setBackground(color); add.setBackground(color); report.setBackground(color); rtn.setBackground(color); help.setBackground(color); for( int i = 0; i < radio.length; i++ ){ radio[i].setBackground(color); } } }); //items for reports //add items for library add.add(bk_mast); bk_mast.setBackground(Color.gray); //add.addSeparator(); add.add(bk_loan); bk_loan.setBackground(Color.gray); //add.addSeparator(); add.add(bk_ret); bk_ret.setBackground(Color.gray); add.addSeparator(); add.add(j_master); j_master.setBackground(Color.gray); //add.addSeparator(); add.add(j_loan); j_loan.setBackground(Color.gray); //add.addSeparator(); add.add(j_ret); j_ret.setBackground(Color.gray); add.addSeparator(); add.add(v_master); v_master.setBackground(Color.gray); //add.addSeparator(); add.add(v_loan); v_loan.setBackground(Color.gray); //add.addSeparator(); add.add(v_ret); v_ret.setBackground(Color.gray); //add.addSeparator(); add.addSeparator(); add.add(pt_mast); pt_mast.setBackground(Color.gray); //add items for menu menu.add(menuItem3); menuItem3.setBackground(Color.gray); //menu.addSeparator(); menu.add(menuItem6); menuItem6.setBackground(Color.gray); menu.addSeparator(); menu.add(menuItem5); menuItem5.setBackground(Color.gray); //add items for window rtn.add(returnItem1); returnItem1.setBackground(Color.gray); //rtn.addSeparator(); rtn.add(returnItem2); returnItem2.setBackground(Color.gray); rtn.addSeparator(); rtn.add(returnItem3); returnItem3.setBackground(Color.gray); //rtn.addSeparator(); rtn.add(returnItem4); returnItem4.setBackground(Color.gray); //add items for report report.add(reportItem1); reportItem1.setBackground(Color.gray); //report.addSeparator(); report.add(reportItem2); reportItem2.setBackground(Color.gray); //add items for help help.add(menuItemhelp1); menuItemhelp1.setBackground(Color.gray); //help.addSeparator(); help.add(menuItemhelp2); menuItemhelp2.setBackground(Color.gray); help.addSeparator(); help.add(menuItemhelp3); menuItemhelp3.setBackground(Color.gray); add.setEnabled(false); menuBar.setBackground(Color.gray); menu.setBackground(Color.gray); add.setBackground(Color.gray); report.setBackground(Color.gray); rtn.setBackground(Color.gray); help.setBackground(Color.gray); for( int i = 0; i < radio.length; i++ ){ radio[i].setBackground(Color.gray); } menuBar(); return menuBar; } public void menuBar() { menuItem6.setEnabled(false); add.setEnabled( false ); menuBar.add(menu); menuBar.add(add); menuBar.add(report); menuBar.add(rtn); menuBar.add(help); } protected void createFrame2() { General_frame frame2 = new General_frame(); desktop.add(frame2); frame2.addInternalFrameListener( this ); try { frame2.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } protected void createFrame3() { ReturnMain frame3 = new ReturnMain(); frame3.setVisible(true); desktop.add(frame3); frame3.addInternalFrameListener( this ); try { frame3.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } protected void createSplash() { splash.setVisible(true); desktop.add(splash); try { splash.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } protected void createBookMaster() { book_master master = new book_master(); master.setVisible(true); desktop.add(master); master.addInternalFrameListener( this ); try { master.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } protected void createBookLoan() { book_loan loan = new book_loan(); loan.setVisible(true); desktop.add(loan); loan.addInternalFrameListener( this ); try { loan.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } protected void createJournal() { journal jor = new journal(); jor.setVisible(true); desktop.add(jor); jor.addInternalFrameListener( this ); try { jor.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } protected void createVideo() { video vid = new video(); vid.setVisible(true); desktop.add(vid); vid.addInternalFrameListener( this ); try { vid.setSelected(true); } catch (java.beans.PropertyVetoException e) {} } public void internalFrameClosing(InternalFrameEvent e) { System.out.println(splash.getX()); add.setEnabled(true); } public void internalFrameClosed(InternalFrameEvent e) { System.out.println(splash.getX()); add.setEnabled(true); } public void internalFrameOpened(InternalFrameEvent e) { System.out.println(splash.getX()); } public void internalFrameIconified(InternalFrameEvent e) { System.out.println(splash.getX()); } public void internalFrameDeiconified(InternalFrameEvent e) { System.out.println(splash.getX()); } public void internalFrameActivated(InternalFrameEvent e) { System.out.println(splash.getX()); } public void internalFrameDeactivated(InternalFrameEvent e) { System.out.println(splash.getX()); } private static void splash() { th.start(); // I sleep to let the thread startup and display the window while (splash3.getWindow() == null || !splash3.getWindow().isShowing()) { try { Thread.sleep(2000); } catch (InterruptedException e){} } } public void changeTheLookAndFeel( int value ) { try { UIManager.setLookAndFeel ( looks[value].getClassName() ); SwingUtilities.updateComponentTreeUI( this ); } catch( Exception e ) { e.printStackTrace(); } } public class ItemHandler implements ItemListener { public void itemStateChanged( ItemEvent e ) { for( int i = 0; i < radio.length; i++ ) if( radio[i].isSelected() ) { changeTheLookAndFeel( i ); } } } public static void main(String[] args) { main frame = new main(); frame.setVisible(true); splash3.getWindow().dispose(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -