⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serversetup.java

📁 Vyger offers a D & D and Rogue-like environment in a graphical online roleplay game.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
      *  Use the wizard's setNextStep() method to set the next step to be displayed.
      *  @return return true to validate the "Previous" button action, false to cancel it...
      */
       protected boolean onPrevious(Object context, JWizard wizard) {
              wizard.setNextStep(  WelcomeWizardStep.getStaticParameters()  );
              return true;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

    }

 /*------------------------------------------------------------------------------------*/

 /**
  * Second Step of our JWizard. Register choices.
  */
  public static class ServerIdWizardStep extends JWizardStep1TextField {

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** This is a static JWizardStep, to build it more simply this method
      *  returns the JWizardStepParameters needed for the JWizard.
      */
       public static JWizardStepParameters getStaticParameters() {
          JWizardStepParameters param = new JWizardStepParameters(
                          "wotlas.server.setup.ServerSetup$ServerIdWizardStep",
                          "Server Identifier" );

          param.setIsPrevButtonEnabled(true);
          param.setIsDynamic(false);

          param.setProperty("init.label0", "Enter your server ID :");

          param.setProperty("init.info0", "\n      To obtain a valid server Id you should contact this address : "
                                         +""+ServerDirector.getRemoteServersProperties().getProperty("info.remoteServerAdminEmail","")
                                         +". Just send a mail to that address and ask for an Id."
                                         +" Once you have your Id enter it here and click on 'next'.");
          return param;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Constructor.
      */
       public ServerIdWizardStep() {
           super();
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Called each time the step is shown on screen.
      */
       protected void onShow(Object context, JWizard wizard) {
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Called when the "Next" button is clicked.
      *  Use the wizard's setNextStep() method to set the next step to be displayed.
      *  @return return true to validate the "Next" button action, false to cancel it...
      */
       protected boolean onNext(Object context, JWizard wizard) {
            if( !super.onNext(context,wizard) )
       	        return false;

            try{
               serverID = Integer.parseInt(getText0());
            }catch(Exception ex) {
               JOptionPane.showMessageDialog( null, "Bad numeric format !", "Error", JOptionPane.ERROR_MESSAGE );
               return false;
            }

            wizard.setNextStep(  ServerInterfaceWizardStep.getStaticParameters()  );
            return true;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Called when Previous button is clicked.
      *  Use the wizard's setNextStep() method to set the next step to be displayed.
      *  @return return true to validate the "Previous" button action, false to cancel it...
      */
       protected boolean onPrevious(Object context, JWizard wizard) {
            wizard.setNextStep(  RegisterChoicesWizardStep.getStaticParameters()  );
            return true;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

    }

 /*------------------------------------------------------------------------------------*/

 /**
  * Second Step of our JWizard. Register choices.
  */
  public static class PrivateServerWizardStep extends JWizardStep2TextField {

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** This is a static JWizardStep, to build it more simply this method
      *  returns the JWizardStepParameters needed for the JWizard.
      */
       public static JWizardStepParameters getStaticParameters() {
          JWizardStepParameters param = new JWizardStepParameters(
                          "wotlas.server.setup.ServerSetup$PrivateServerWizardStep",
                          "Private Wotlas Network" );

          param.setIsPrevButtonEnabled(true);
          param.setIsDynamic(true);

          param.setProperty("init.label0", "Wotlas web server's URL:");
          param.setProperty("init.text0", ServerDirector.getRemoteServersProperties().getProperty("info.remoteServerHomeURL","") );

          param.setProperty("init.label1", "Wotlas manager's email:");
          param.setProperty("init.text1", ServerDirector.getRemoteServersProperties().getProperty("info.remoteServerAdminEmail","") );

          param.setProperty("init.info0", "\n      We need this information to know how to contact a specified"
                                         +" wotlas network. If you don't know them please refer to the"
                                         +" web site where you downloaded this package.");
          return param;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Constructor.
      */
       public PrivateServerWizardStep() {
           super();
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Called each time the step is shown on screen.
      */
       protected void onShow(Object context, JWizard wizard) {
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Called when the "Next" button is clicked.
      *  Use the wizard's setNextStep() method to set the next step to be displayed.
      *  @return return true to validate the "Next" button action, false to cancel it...
      */
       protected boolean onNext(Object context, JWizard wizard) {
       	  if( !super.onNext(context,wizard) )
       	      return false;

          int value = JOptionPane.showConfirmDialog(null, "Save this information ? (required for next step)", "Save", JOptionPane.YES_NO_OPTION);
          if( value != JOptionPane.YES_OPTION ) return false;

          ServerDirector.getRemoteServersProperties().setProperty( "info.remoteServerHomeURL", getText0() );
          ServerDirector.getRemoteServersProperties().setProperty( "info.remoteServerAdminEmail", getText1() );

          wizard.setNextStep( ServerIdWizardStep.getStaticParameters()  );
          return true;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Called when Previous button is clicked.
      *  Use the wizard's setNextStep() method to set the next step to be displayed.
      *  @return return true to validate the "Previous" button action, false to cancel it...
      */
       protected boolean onPrevious(Object context, JWizard wizard) {
            wizard.setNextStep(  RegisterChoicesWizardStep.getStaticParameters() );
            return true;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

    }

 /*------------------------------------------------------------------------------------*/

 /**
  * Second Step of our JWizard. Server Interface Choice.
  */
  public static class ServerInterfaceWizardStep extends JWizardStep implements ActionListener{

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** This is a static JWizardStep, to build it more simply this method
      *  returns the JWizardStepParameters needed for the JWizard.
      */
       public static JWizardStepParameters getStaticParameters() {
          JWizardStepParameters param = new JWizardStepParameters(
                          "wotlas.server.setup.ServerSetup$ServerInterfaceWizardStep",
                          "Server Network Interface Setup" );

          param.setIsPrevButtonEnabled(true);
          param.setIsDynamic(true);
          return param;
       }

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

      /** Swing Components
       */
       private ATextField t_itfName, t_itfPublish;
       private ALabel l_itfDesc,l1,l2,l3,l4;
       private JPanel autoPanel, fixedPanel;

       private JComboBox c_itfName,c_ipName;
       private ARadioButton r_automatic, r_fixed, r_publishSelect, r_publishFixed,
                            r_automaticUpdate, r_manualUpdate;
       private ButtonGroup btGroupItf, btGroupPublish, btGroupUpdate;

     /* -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  */

     /** Constructor.
      */
       public ServerInterfaceWizardStep() {
           super();

        // I - Swing components
           setLayout( new BorderLayout() );
           JPanel mainPanel = new JPanel();
           mainPanel.setLayout( new BorderLayout() );
           mainPanel.setBackground(Color.white);
           add(mainPanel,BorderLayout.CENTER);
           mainPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,10));

         // First Radio section
            r_automatic = new ARadioButton("Automatic Interface Detection & Monitoring");
            r_automatic.setActionCommand("automaticItf");
            r_automatic.addActionListener(this);

            r_fixed = new ARadioButton("Fixed IP/DNS name");
            r_fixed.setActionCommand("fixedItf");
            r_fixed.addActionListener(this);

            btGroupItf = new ButtonGroup();
            btGroupItf.add(r_automatic);
            btGroupItf.add(r_fixed);

         // Automatic Itf Detection components
            autoPanel = new JPanel(new GridLayout(3,2,0,0));
            autoPanel.setBackground(Color.white);
            autoPanel.setBorder(BorderFactory.createEmptyBorder(0,50,0,10));
            
            l1 = new ALabel("Network Interfaces :");
            l1.setBackground(Color.white);
            autoPanel.add( l1 );

            String itf[] = NetInterface.getInterfaceNames();
            c_itfName = new JComboBox( itf );
            c_itfName.setEditable(false);
            if(itf.length!=0) c_itfName.setSelectedIndex(0);
            c_itfName.addActionListener(this);
            c_itfName.setActionCommand("itf");
            autoPanel.add( c_itfName );

            l2 = new ALabel("Interface Description:");
            l2.setBackground(Color.white);
            autoPanel.add( l2 );

            l_itfDesc = new ALabel("-");
            if(itf.length!=0) l_itfDesc.setText( NetInterface.getInterfaceDescription(itf[0]) );
            l_itfDesc.setBackground(Color.white);
            autoPanel.add( l_itfDesc );

            l3 = new ALabel("Interface IP addresses:");
            l3.setBackground(Color.white);
            autoPanel.add( l3 );

            String ip[] = new String[0];
            if(itf.length!=0) ip = NetInterface.getInterfaceAddresses(itf[0]);

            c_ipName = new JComboBox( ip );
            c_ipName.setEditable(false);
            if(ip.length!=0) c_ipName.setSelectedIndex(0);
            autoPanel.add( c_ipName );

         // Fixed Itf components
            fixedPanel = new JPanel(new GridLayout(1,2,0,0));
            fixedPanel.setBackground(Color.white);
            fixedPanel.setBorder(BorderFactory.createEmptyBorder(0,50,0,10));
            
            l4 = new ALabel("Enter the address to use :");
            l4.setBackground(Color.white);
            fixedPanel.add( l4 );

            t_itfName = new ATextField("");
            t_itfName.setBackground(Color.white);
            fixedPanel.add( t_itfName );

         // Creation of the network interface panel

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -