📄 annotations.java
字号:
public void stateChanged(ChangeEvent event)
{
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
borderWidthPanel.add(this.borderWidthSlider);
//-- Stipple factor panel ----------------------------------------------------
JPanel stippleFactorPanel = new JPanel();
stippleFactorPanel.setLayout(new BoxLayout(stippleFactorPanel, BoxLayout.X_AXIS));
stippleFactorPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
stippleFactorPanel.add(new JLabel("Stipple factor:"));
stippleFactorPanel.add(Box.createRigidArea(new Dimension(10, 0)));
this.stippleFactorSlider = new JSlider(JSlider.HORIZONTAL, 0, 10, 0);
this.stippleFactorSlider.setMajorTickSpacing(1);
this.stippleFactorSlider.setPaintLabels(true);
this.stippleFactorSlider.setToolTipText("Border line pattern repeat factor");
this.stippleFactorSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
stippleFactorPanel.add(this.stippleFactorSlider);
//-- Scale and opacity panel ----------------------------------------------------
JPanel scalePanel = new JPanel(new GridLayout(0, 1, 0, 0));
scalePanel.setBorder(
new CompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), new TitledBorder("Scale and Opacity")));
this.scaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 30, 10);
this.scaleSlider.setMajorTickSpacing(10);
this.scaleSlider.setMinorTickSpacing(1);
//this.scaleSlider.setPaintTicks(true);
this.scaleSlider.setPaintLabels(true);
this.scaleSlider.setToolTipText("Annotation scaling");
this.scaleSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
scalePanel.add(this.scaleSlider);
this.opacitySlider = new JSlider(JSlider.HORIZONTAL, 0, 10, 10);
this.opacitySlider.setMajorTickSpacing(1);
//this.opacitySlider.setMinorTickSpacing(1);
//this.opacitySlider.setPaintTicks(true);
this.opacitySlider.setPaintLabels(true);
this.opacitySlider.setToolTipText("Annotation opacity");
this.opacitySlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
scalePanel.add(this.opacitySlider);
// -- Font --------------------------------------------------------------
JPanel fontPanel = new JPanel();
fontPanel.setLayout(new BoxLayout(fontPanel, BoxLayout.X_AXIS));
fontPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
fontPanel.add(new JLabel("Font"));
fontPanel.add(Box.createRigidArea(new Dimension(10, 0)));
this.cbFontName = new JComboBox(new String[] {"Arial", "SansSerif", "Serif", "Courier", "Times", "Helvetica", "Trebuchet", "Tahoma"});
this.cbFontName.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
fontPanel.add(this.cbFontName);
fontPanel.add(Box.createRigidArea(new Dimension(10, 0)));
this.cbFontStyle = new JComboBox(new String[] {"Plain", "Bold", "Italic", "BoldItalic"});
this.cbFontStyle.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
fontPanel.add(this.cbFontStyle);
fontPanel.add(Box.createRigidArea(new Dimension(10, 0)));
this.cbFontSize = new JComboBox(new String[] {"10", "12", "14", "16", "18", "20", "24", "28", "34", "48", "64"});
this.cbFontSize.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
fontPanel.add(this.cbFontSize);
//fontPanel.add(Box.createRigidArea(new Dimension(10, 0)));
// -- Text align panel -------------------------------------------------------
final JPanel alignPanel = new JPanel(new GridLayout(0, 3, 5, 5));
alignPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
alignPanel.add(new JLabel("Align & Effect:"));
this.cbTextAlign = new JComboBox(new String[] {"Left", "Center", "Right"});
this.cbTextAlign.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
alignPanel.add(this.cbTextAlign);
this.cbTextEffect = new JComboBox(new String[] {"None", "Shadow", "Outline"});
this.cbTextEffect.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
alignPanel.add(this.cbTextEffect);
// -- Adjust width panel -------------------------------------------------------
final JPanel adjustWidthPanel = new JPanel(new GridLayout(0, 1, 5, 5));
adjustWidthPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
this.cbAdjustWidth = new JCheckBox("Adjust width to text");
this.cbAdjustWidth.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
this.cbAdjustWidth.setSelected(true);
adjustWidthPanel.add(this.cbAdjustWidth);
// -- Shape and leader panel -----------------------------------------------
final JPanel shapePanel = new JPanel(new GridLayout(0, 2, 5, 5));
shapePanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
shapePanel.add(new JLabel("Shape:"));
this.cbShape = new JComboBox(new String[] {"Rectangle", "Ellipse", "None"});
this.cbShape.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
shapePanel.add(this.cbShape);
shapePanel.add(new JLabel("Leader:"));
this.cbLeader = new JComboBox(new String[] {"Triangle", "None"});
this.cbLeader.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
shapePanel.add(this.cbLeader);
// -- Image select panel -----------------------------------------------
final JPanel imagePanel = new JPanel(new GridLayout(0, 2, 5, 5));
imagePanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
imagePanel.add(new JLabel("Image:"));
this.cbImage = new JComboBox(new String[] {"None", "Earth", "NASA", "WWJ Splash", "Custom"});
this.cbImage.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
imagePanel.add(this.cbImage);
imagePanel.add(new JLabel("Repeat:"));
this.cbImageRepeat = new JComboBox(new String[] {"None", "Repeat-X", "Repeat-Y", "Repeat-XY"});
this.cbImageRepeat.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
imagePanel.add(this.cbImageRepeat);
//-- Image scale and opacity panel ----------------------------------------------
JPanel imageScalePanel = new JPanel(new GridLayout(0, 1, 0, 0));
imageScalePanel.setBorder(
new CompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), new TitledBorder("Scale and Opacity")));
this.imageScaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 30, 10);
this.imageScaleSlider.setMajorTickSpacing(10);
this.imageScaleSlider.setMinorTickSpacing(1);
this.imageScaleSlider.setPaintLabels(true);
this.imageScaleSlider.setToolTipText("Background image scaling");
this.imageScaleSlider.addChangeListener(new ChangeListener()
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -