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

📄 wapoptions.java

📁 WAP ide 代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    FilesPanel.add(FilesDirButton, new GridBagConstraints(5, 3, 1, 2, 0.0, 0.0            ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    FilesPanel.add(EnableBackupCheckbox, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0            ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, -9, 0, 9), 0, 0));    FilesPanel.add(MinsLabel, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    FilesPanel.add(BackupTimeLabel, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0            ,GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(0, 7, 0, 1), 0, 0));    FilesPanel.add(FilesDirText, new GridBagConstraints(0, 3, 5, 1, 0.0, 0.0            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 273, 0));    OptionPanes.add(EncoderPanel,   "Encoder");    EncoderPanel.add(StringTableCheckbox,  new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0            ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));    for (int x = 0; x < 10; x++)      ColorChoices[x] = Color.black;    KeywordColorTypeList.setListData(ColorTypeChoices);    csm.addChangeListener(new ChangeListener() {      public void stateChanged(ChangeEvent e) {        csm_colorChanged(e);      }    });    OptionPanes.setSelectedComponent(ColorPanel);  }  private void CancelButton_actionPerformed(ActionEvent e) {    setVisible(false);    OKPressed = false;  }  private void OkButton_actionPerformed(ActionEvent e) {    saveData();    setVisible(false);  }  private void EnableBackupCheckbox_actionPerformed(ActionEvent e) {    if (EnableBackupCheckbox.isSelected()) {      BackupTimeLabel.setEnabled(true);      BackupTimeText.setEnabled(true);      MinsLabel.setEnabled(true);    }    else {      BackupTimeLabel.setEnabled(false);      BackupTimeText.setEnabled(false);      MinsLabel.setEnabled(false);    }  }  private void BackupDirButton_actionPerformed(ActionEvent e) {    JFileChooser fc;    if (!(BackupDirText.getText().equals("")))      fc = new JFileChooser(BackupDirText.getText());    else      fc = new JFileChooser();    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);    if (fc.showDialog(this, "Select Directory") == JFileChooser.APPROVE_OPTION)      BackupDirText.setText(fc.getSelectedFile().toString());  }  private void FilesDirButton_actionPerformed(ActionEvent e) {    JFileChooser fc;    if (!(FilesDirText.getText().equals("")))      fc = new JFileChooser(FilesDirText.getText());    else      fc = new JFileChooser();    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);    if (fc.showDialog(this, "Select Directory") == JFileChooser.APPROVE_OPTION)      FilesDirText.setText(fc.getSelectedFile().toString());  }  void KeywordColorTypeList_valueChanged(ListSelectionEvent e) {    ColorChooserPanel.setColor(ColorChoices[KeywordColorTypeList.getSelectedIndex()]);  }  private void csm_colorChanged(ChangeEvent e) {    ColorChoices[KeywordColorTypeList.getSelectedIndex()] = ColorChooserPanel.getColor();  }  private void loadData() {    String fileData = "";    String fileName = "";    Vector Data;    try {      fileName = wapide.IDEFrame.class.getResource("IDESettings.txt").getFile();      // Read data      FileInputStream fis = new FileInputStream (fileName);      int size = fis.available();      byte[] bytes = new byte [size];      fis.read (bytes);      fileData = new String (bytes);      fis.close();      // Store Data into a vector      Data = new Vector();      StringTokenizer newline = new StringTokenizer(fileData, "\n");      // Parse the data      while (newline.hasMoreTokens()) {        StringTokenizer equalsign = new StringTokenizer(newline.nextToken(), "=");        while (equalsign.hasMoreTokens()) {          try {            equalsign.nextToken();            Data.add(equalsign.nextToken());          }          catch (NoSuchElementException e) {            Data.add(new String(""));          }        }      }      // Get the colors      for (int x = 0; x < 10; x++) {        String s = (String) Data.get(x);        Integer i = new Integer(s);        int color = i.intValue();        ColorChoices[x] = new Color(color);      }      // Get editor options      TabSizeText.setText((String) Data.get(10));      if (((String) Data.get(11)).equals("true"))        SmartIndentCheckbox.setSelected(true);      else        SmartIndentCheckbox.setSelected(false);      if (((String) Data.get(12)).equals("true"))        TrailingCheckbox.setSelected(true);      else        TrailingCheckbox.setSelected(false);      if (((String) Data.get(13)).equals("true"))        HighlightingCheckbox.setSelected(true);      else        HighlightingCheckbox.setSelected(false);      // Get file options      BackupDirText.setText((String) Data.get(14));      FilesDirText.setText((String) Data.get(15));      if (((String) Data.get(16)).equals("true"))        EnableBackupCheckbox.setSelected(true);      else        EnableBackupCheckbox.setSelected(false);      BackupTimeText.setText((String) Data.get(17));      try {        if (((String) Data.get(18)).equals("true"))          StringTableCheckbox.setSelected(true);        else          StringTableCheckbox.setSelected(false);      }      catch (ArrayIndexOutOfBoundsException arrerr) {        StringTableCheckbox.setSelected(true);      }    }    catch (IOException e) {    }  }  private void saveData() {    String fileName = "";    String fileData = "";    try {      fileName = wapide.IDEFrame.class.getResource("IDESettings.txt").getFile();      // Prepare data      String indent = "false";      String trailing = "false";      String highlight = "false";      String backup = "false";      String stringtable = "false";      if (SmartIndentCheckbox.isSelected())        indent = "true";      if (TrailingCheckbox.isSelected())        trailing = "true";      if (HighlightingCheckbox.isSelected())        highlight = "true";      if (EnableBackupCheckbox.isSelected())        backup = "true";      if (StringTableCheckbox.isSelected())        stringtable = "true";      // format as a string      for (int x = 0; x < 10; x++) {        Integer c = new Integer(ColorChoices[x].getRGB());        fileData = fileData + "color=" + c.toString() + "\n";      }      fileData = fileData + "tabsize=" + TabSizeText.getText() + "\n";      fileData = fileData + "smartindent=" + indent + "\n";      fileData = fileData + "trailingspaces=" + trailing + "\n";      fileData = fileData + "highlight=" + highlight + "\n";      fileData = fileData + "backupdir=" + BackupDirText.getText() + "\n";      fileData = fileData + "filesdir=" + FilesDirText.getText() + "\n";      fileData = fileData + "enablebackup=" + backup + "\n";      fileData = fileData + "backuptime=" + BackupTimeText.getText() + "\n";      fileData = fileData + "stringtable=" + stringtable;      // Save the data      FileOutputStream DataOut = new FileOutputStream(fileName);      DataOut.write(fileData.getBytes());      DataOut.close();    }    catch (IOException e) {    }  }  public Vector getData() {    Vector v = new Vector();    for (int x = 0; x < 10; x++)      v.add(ColorChoices[x]);    v.add(TabSizeText.getText());    v.add(SmartIndentCheckbox);    v.add(TrailingCheckbox);    v.add(HighlightingCheckbox);    v.add(BackupDirText.getText());    v.add(FilesDirText.getText());    v.add(EnableBackupCheckbox);    v.add(BackupTimeText.getText());    v.add(StringTableCheckbox);    return v;  }  public boolean getButtonPressed() {    return OKPressed;  }}

⌨️ 快捷键说明

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