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

📄 optionsdialog.java

📁 java写的图片浏览器,类似acds
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package org.net9.oops.jsee;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
//import java.io.*;
//import java.util.*;
import java.awt.BorderLayout;
import javax.swing.border.*;

public class OptionsDialog extends JDialog {
  JPanel panel1 = new JPanel();
  JPanel panel2 = new JPanel();
  BorderLayout borderLayout1 = new BorderLayout();
  JTabbedPane jTabbedPane = new JTabbedPane();
  JPanel General = new JPanel();

  JRadioButton DefaultRButton = new JRadioButton();
  JRadioButton SmoothRButton = new JRadioButton();
  JRadioButton FastRButton = new JRadioButton();
  public ButtonGroup RadioButtonGroup;
  public ButtonGroup LayoutRadioButtonGroup;

  JCheckBox UsePreOptionCheckBox = new JCheckBox();
  JCheckBox AutoSizeCheckBox = new JCheckBox();
  JCheckBox HidePreviewCheckBox = new JCheckBox();

  JPanel ThumbNail = new JPanel();
  JPanel Layout = new JPanel();
  JPanel SlideShow = new JPanel();

  JSlider widthSlider = new JSlider();
  JSlider heightSlider = new JSlider();
  JButton PreviewSizeButton = new JButton();

  JButton OKButton = new JButton();
  JButton CancelButton = new JButton();
  //Add by Neoya 2002-03-05
  JButton saveDefaultButton=new JButton();
  // 2 labels for General tab: 1 for the scale quality radio boxes, 1 for check boxes
  JPanel Quality_Label = new JPanel();
  JPanel Option_Label = new JPanel();
  JPanel Preview_Size = new JPanel();

  // constant
  int   maxH = 174,
        maxW = 232,
        minH = 54,
        minW = 72,
        defaultH = 120,
        defaultW = 160;
  // attribute of preview button
  int   pX = 52,
        pY = 42,
        filename_title = 28;

  static int    pWidth,
                pHeight;

  final Jsee dummy;
  boolean Auto_Size_Preview = true;
  boolean View_Full_Screen = false;
  boolean Save_Previous_Option = false;
  boolean Set_Use_Previous_Option = false;
  boolean Hide_Preview = false;

  public int scale_quality = 1;
  public int ColumnLayout =Properties.COLUMN_LAYOUT_LIST; // current values: "LIST" or "PREVIEW"
  public int CurrentColumnLayout;
  private String directory_path;

  BorderLayout borderLayout2 = new BorderLayout();
  BorderLayout borderLayout3 = new BorderLayout();
  BorderLayout borderLayout4 = new BorderLayout();
  BorderLayout borderLayout5 = new BorderLayout();

  JRadioButton S2Column = new JRadioButton();
  JRadioButton S3Column = new JRadioButton();
  ButtonGroup SlideButtonGroup = new ButtonGroup();
  JRadioButton jRadioFoward = new JRadioButton();
  JRadioButton jRadioReverse = new JRadioButton();
  JSlider jDelaySlider = new JSlider();
  JTextField jDelayTextField = new JTextField();
  JLabel jDelayTimeLabel = new JLabel();
  JPanel jSequencePanel = new JPanel();
  JPanel jDelayPanel = new JPanel();

  public OptionsDialog(Jsee parent) {
      super(parent, "Options", false);
      dummy = parent;
      try  {
          jbInit();
          pack();
      }
      catch(Exception ex) {
          ex.printStackTrace();
      }
      reshape(120,120,360,342);
  }

  void jbInit() throws Exception {
    Properties p=new Properties();
    //What this means?
    Set_Use_Previous_Option = true;
    // Get quality
    String s=p.getProperty(Properties.SCALE_QUALITY);
    if (!s.equals(""))
      scale_quality = Integer.parseInt(s);
    else
      scale_quality=0;
    // Get operating option
    Save_Previous_Option = Boolean.valueOf(p.getProperty(Properties.SAVE_PREVIOUS_OPTION)).booleanValue(); 
    
    View_Full_Screen = Boolean.valueOf(p.getProperty(Properties.VIEW_FULL_SCREEN)).booleanValue();
    dummy.ViewFullScreen(View_Full_Screen);
    
//    Auto_Size_Preview = Boolean.valueOf(p.getProperty(Properties.AUTO_SIZE_PREVIEW)).booleanValue();   
    Auto_Size_Preview = p.getBooleanProperty(Properties.AUTO_SIZE_PREVIEW);   
    
    Hide_Preview = Boolean.valueOf(p.getProperty(Properties.HIDE_PREVIEW)).booleanValue();
    HidePreviewCheckBox.setSelected(Hide_Preview);
    dummy.ThumbNailIsShowing = Boolean.valueOf(p.getProperty(Properties.THUMBNAIL_SHOW)).booleanValue();
    ColumnLayout = p.getIntProperty(Properties.COLUMN_LAYOUT);
    if(ColumnLayout==0)
      ColumnLayout=Properties.COLUMN_LAYOUT_LIST;//Default
    // Get thumb width & height
    s=p.getProperty(Properties.WIDTH);
    if(s.equals(""))
      pWidth=defaultW;
    else
      pWidth = Integer.parseInt(s);

    s=p.getProperty(Properties.HEIGHT);
    if(s.equals(""))
      pHeight=defaultH;
    else
      pHeight = Integer.parseInt(s);
    // Get previous directory path
    directory_path = p.getProperty(Properties.PATH);
    //End of Modified by Neoya

    CurrentColumnLayout = ColumnLayout;
    panel1.setLayout(borderLayout1);
    General.setLayout(borderLayout2);
    Quality_Label.setLayout(borderLayout3);
    Option_Label.setLayout(borderLayout4);

    // Radio buttons
    DefaultRButton.setText("Default");
    SmoothRButton.setText("Smooth - Very slow");
    FastRButton.setText("Fast - Low quality");
    RadioButtonGroup = new ButtonGroup();
    LayoutRadioButtonGroup = new ButtonGroup();
    // radio button group, only one can be selected at an instance
    Quality_Label.setPreferredSize(new Dimension(140, 145));
    UsePreOptionCheckBox.setPreferredSize(new Dimension(135, 33));
    if (Set_Use_Previous_Option)
        UsePreOptionCheckBox.setSelected(true);
    else
        UsePreOptionCheckBox.setSelected(false);
    HidePreviewCheckBox.setPreferredSize(new Dimension(90, 33));

    AutoSizeCheckBox.setPreferredSize(new Dimension(131, 33));

    S2Column.setPreferredSize(new Dimension(103, 120));
    S2Column.setText("Splitview with list at left");
    S2Column.setBounds(new Rectangle(49, 116, 314, 124));
    S2Column.setIcon(new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/List_Large_Alpha.gif")));
    S2Column.setSelectedIcon(new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/List_Large.gif")));
    Layout.setLayout(null);
    S3Column.setPreferredSize(new Dimension(103, 105));
    S3Column.setText("Splitview with preview at left");
    S3Column.setBounds(new Rectangle(49, 15, 314, 105));
    S3Column.setIcon(new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/Preview_Large_Alpha.gif")));
    S3Column.setSelectedIcon(new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/Preview_Large.gif")));
    if (ColumnLayout==Properties.COLUMN_LAYOUT_PREVIEW)
        S3Column.setSelected(true);
    else
        S2Column.setSelected(true);
// Slide show tab
    SlideShow.setLayout(null);
    jRadioFoward.setText("Forward");
    jRadioFoward.setSelected(true);
    jRadioFoward.setBounds(new Rectangle(19, 23, 72, 25));
    jRadioFoward.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jRadioFoward_actionPerformed(e);
      }
    });

    jRadioReverse.setText("Reverse");
    //temporary disable reverse slide show
    jRadioReverse.setEnabled(false);
    jRadioReverse.setBounds(new Rectangle(18, 51, 72, 25));
    jRadioReverse.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jRadioReverse_actionPerformed(e);
      }
    });

    jDelaySlider.setBounds(new Rectangle(12, 38, 200, 27));
    jDelaySlider.setMinorTickSpacing(1);
    jDelaySlider.setPaintTicks(true);
    jDelaySlider.setMaximum(10);
    jDelaySlider.setSnapToTicks(true);
    jDelaySlider.setValue(2);

    // Listeners
    jDelaySlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            jDelayTextField.setText("" + jDelaySlider.getValue());
            OKButton.setEnabled(true);
        }
    });
    //

    jDelayTextField.setToolTipText("");
    jDelayTextField.setEditable(false);
    jDelayTextField.setText("" + jDelaySlider.getValue());
    jDelayTextField.setHorizontalAlignment(SwingConstants.RIGHT);
    jDelayTextField.setBounds(new Rectangle(18, 72, 37, 21));

    jDelayTimeLabel.setText("seconds");
    jDelayTimeLabel.setBounds(new Rectangle(62, 72, 133, 21));

    jSequencePanel.setBounds(new Rectangle(29, 25, 115, 83));
    jSequencePanel.setLayout(null);
    jDelayPanel.setBounds(new Rectangle(30, 118, 227, 113));
    jDelayPanel.setLayout(null);
//
    PreviewSizeButton.setBackground(new Color(144, 164, 236));
    LayoutRadioButtonGroup.add(S2Column);
    LayoutRadioButtonGroup.add(S3Column);

    RadioButtonGroup.add(FastRButton);
    RadioButtonGroup.add(DefaultRButton);
    RadioButtonGroup.add(SmoothRButton);
    // set radio button
    if (scale_quality == 0)
        FastRButton.setSelected(true);
    else if (scale_quality == 1)
        DefaultRButton.setSelected(true);
    else if (scale_quality == 2)
        SmoothRButton.setSelected(true);

    // Checkbox buttons
    UsePreOptionCheckBox.setText("Use previous option");
    AutoSizeCheckBox.setText("Auto Size Preview");
    HidePreviewCheckBox.setText("Hide Preview in Thumb Nail mode");

    // Set checkbox button
    if (Auto_Size_Preview)
        AutoSizeCheckBox.setSelected(true);
    if (Save_Previous_Option)
        UsePreOptionCheckBox.setSelected(true);

    ThumbNail.setLayout(null);
    widthSlider.setBounds(new Rectangle(45, 20, 253, 27));
    heightSlider.setOrientation(JSlider.VERTICAL);
    heightSlider.setInverted(true);
    heightSlider.setBounds(new Rectangle(26, 39, 29, 196));

    widthSlider.setMinorTickSpacing(16);
    heightSlider.setMinorTickSpacing(12);
    widthSlider.setSnapToTicks(true);
    widthSlider.setPaintTicks(true);

⌨️ 快捷键说明

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