📄 optionsdialog.java
字号:
widthSlider.setMaximum(maxW);
widthSlider.setValue(pWidth - 16); // I don't know why I have to minus 16 to make it work OK
widthSlider.setMinimum(minW);
heightSlider.setSnapToTicks(true);
heightSlider.setPaintTicks(true);
heightSlider.setMaximum(maxH);
heightSlider.setValue(pHeight- 12); // I don't know why I have to minus 12 to make it work OK
heightSlider.setMinimum(minH);
// Add listener
widthSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
ChangePreviewButtonSize(widthSlider.getValue(), heightSlider.getValue());
OKButton.setEnabled(true);
}
});
heightSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
ChangePreviewButtonSize(widthSlider.getValue(), heightSlider.getValue());
OKButton.setEnabled(true);
}
});
FastRButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
OKButton.setEnabled(true);
scale_quality = 0;
}
});
DefaultRButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
OKButton.setEnabled(true);
scale_quality = 1;
}
});
SmoothRButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
OKButton.setEnabled(true);
scale_quality = 2;
}
});
AutoSizeCheckBox.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
Auto_Size_Preview = AutoSizeCheckBox.isSelected();
dummy.setAutoSize(Auto_Size_Preview);
OKButton.setEnabled(true);
}
});
UsePreOptionCheckBox.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
Save_Previous_Option = UsePreOptionCheckBox.isSelected();
OKButton.setEnabled(true);
}
});
HidePreviewCheckBox.addActionListener(new ActionListener() {
public void actionPerformed( ActionEvent event ) {
Hide_Preview = HidePreviewCheckBox.isSelected();
dummy.HidePreview(Hide_Preview);
OKButton.setEnabled(true);
}
});
OKButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
// write the changed option to variable
dummy.resize_quality = scale_quality;
dummy.setAutoSize(Auto_Size_Preview);
dummy.Save_Previous_Option = Save_Previous_Option;
pWidth = widthSlider.getValue();
dummy.thumb_width = pWidth;
pHeight = heightSlider.getValue();
dummy.image_thumb_height = pHeight;
dummy.thumb_height = pHeight + filename_title;
dummy.slideShowDelayTime = jDelaySlider.getValue();
// change column layout when needed
if (!(ColumnLayout==CurrentColumnLayout)) {
dummy.ChangeColumnLayout(ColumnLayout);
CurrentColumnLayout = ColumnLayout;
}
dispose();
}
});
CancelButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
dispose();
}
});
//Add by Neoya 2002-03-06
saveDefaultButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
//Save the options as default
Properties p=new Properties();
dummy.resize_quality = scale_quality;
dummy.setAutoSize(Auto_Size_Preview);
if (Auto_Size_Preview)
p.setProperty(Properties.AUTO_SIZE_PREVIEW,true);
else
p.setProperty(Properties.AUTO_SIZE_PREVIEW,false);
pWidth = widthSlider.getValue();
dummy.thumb_width = pWidth;
p.setProperty(Properties.WIDTH,pWidth);
pHeight = heightSlider.getValue();
dummy.image_thumb_height = pHeight;
p.setProperty(Properties.HEIGHT,pHeight);
dummy.thumb_height = pHeight + filename_title;
dummy.slideShowDelayTime = jDelaySlider.getValue();
p.setProperty(Properties.HIDE_PREVIEW,Hide_Preview);
p.setProperty(Properties.COLUMN_LAYOUT,ColumnLayout);
if (!(ColumnLayout==CurrentColumnLayout)) {
dummy.ChangeColumnLayout(ColumnLayout);
CurrentColumnLayout = ColumnLayout;
}
//
dispose();
}
});
S2Column.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
ColumnLayout = Properties.COLUMN_LAYOUT_LIST;
OKButton.setEnabled(true);
}
});
S3Column.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent event ) {
ColumnLayout = Properties.COLUMN_LAYOUT_PREVIEW;
OKButton.setEnabled(true);
}
});
// end listener
if (pWidth < 128)
PreviewSizeButton.setFont(new java.awt.Font("Dialog", 1, 10));
else
PreviewSizeButton.setFont(new java.awt.Font("Dialog", 1, 12));
PreviewSizeButton.setText(pWidth + " x " + pHeight + " pixels");
PreviewSizeButton.setBounds(new Rectangle(pX + (253 - pWidth)/2 , pY + (196 - pHeight)/2, pWidth, pHeight));
getContentPane().add(panel1);
OKButton.setText("OK");
CancelButton.setText("Cancel");
//Add by Neoya 2002-03-06
saveDefaultButton.setText("SaveDefault");
// jTabbedPane.setTabPlacement(SwingConstants.LEFT);
panel1.add(jTabbedPane, BorderLayout.CENTER);
panel1.add(panel2, BorderLayout.SOUTH);
panel2.add(OKButton, BorderLayout.WEST);
panel2.add(CancelButton, BorderLayout.EAST);
//Add by Neoya 2002-03-06
panel2.add(saveDefaultButton,BorderLayout.EAST);
jTabbedPane.add(General, "General");
Quality_Label.add(FastRButton, BorderLayout.NORTH);
Quality_Label.add(DefaultRButton, BorderLayout.CENTER);
Quality_Label.add(SmoothRButton, BorderLayout.SOUTH);
Quality_Label.setBorder(new TitledBorder(LineBorder.createBlackLineBorder(),
"Scale Quality"));
Option_Label.add(UsePreOptionCheckBox, BorderLayout.NORTH);
Option_Label.add(AutoSizeCheckBox, BorderLayout.CENTER);
Option_Label.add(HidePreviewCheckBox, BorderLayout.SOUTH);
General.add(Quality_Label, BorderLayout.NORTH);
General.add(Option_Label, BorderLayout.CENTER);
jTabbedPane.add(ThumbNail, "Thumbnails");
ThumbNail.add(heightSlider, null);
ThumbNail.add(widthSlider, null);
ThumbNail.add(PreviewSizeButton, null);
jTabbedPane.add(Layout, "Layout");
Layout.add(S2Column, null);
Layout.add(S3Column, null);
jTabbedPane.add(SlideShow, "Slide Show");
SlideShow.add(jSequencePanel, null);
jSequencePanel.add(jRadioFoward, null);
jSequencePanel.add(jRadioReverse, null);
SlideShow.add(jDelayPanel, null);
jDelayPanel.add(jDelaySlider, null);
jDelayPanel.add(jDelayTimeLabel, null);
jDelayPanel.add(jDelayTextField, null);
jDelayPanel.setBorder(new TitledBorder(LineBorder.createBlackLineBorder(),
"Delay"));
jSequencePanel.setBorder(new TitledBorder(LineBorder.createBlackLineBorder(),
"Sequence"));
SlideButtonGroup.add(jRadioFoward);
SlideButtonGroup.add(jRadioReverse);
} // end constructor
public void show() {
AutoSizeCheckBox.setSelected(dummy.getAutoSize());
OKButton.setEnabled( false ); // OK button always disable until user change option
super.show();
}
public void ChangePreviewButtonSize(int width, int height) {
PreviewSizeButton.reshape(pX + (253 - width)/2 , pY + (196 - height)/2, width, height);
if (width < 128)
PreviewSizeButton.setFont(new java.awt.Font("Dialog", 1, 10));
else
PreviewSizeButton.setFont(new java.awt.Font("Dialog", 1, 12));
PreviewSizeButton.setText(width + " x " + height + " pixels");
}
static public int GetPreviewWidth()
{
return pWidth;
}
static public int GetPreviewHeight()
{
return pHeight;
}
public boolean getHidePreview() {
return Hide_Preview;
}
public int getColumnLayout() {
return ColumnLayout;
}
public boolean CharToBoolean( char c ) {
if (c == '0')
return false;
else if (c == '1')
return true;
else
return false;
}
public String getDefaultPath() {
return directory_path;
}
public boolean getUsePreviousOption() {
return UsePreOptionCheckBox.isSelected();
}
void jRadioFoward_actionPerformed(ActionEvent e) {
if (jRadioFoward.isSelected()) {
dummy.slideShowForward = true;
OKButton.setEnabled( true );
}
}
void jRadioReverse_actionPerformed(ActionEvent e) {
if (jRadioReverse.isSelected()) {
dummy.slideShowForward = false;
OKButton.setEnabled( true );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -