📄 annotations.java
字号:
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
imageScalePanel.add(this.imageScaleSlider);
this.imageOpacitySlider = new JSlider(JSlider.HORIZONTAL, 0, 10, 10);
this.imageOpacitySlider.setMajorTickSpacing(1);
this.imageOpacitySlider.setPaintLabels(true);
this.imageOpacitySlider.setToolTipText("Background image opacity");
this.imageOpacitySlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
imageScalePanel.add(this.imageOpacitySlider);
//-- Image offset panel ----------------------------------------------
JPanel imageOffsetPanel = new JPanel(new GridLayout(0, 1, 0, 0));
imageOffsetPanel.setBorder(
new CompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), new TitledBorder("Offset")));
this.imageOffsetXSlider = new JSlider(JSlider.HORIZONTAL, -200, 200, 0);
this.imageOffsetXSlider.setMajorTickSpacing(100);
this.imageOffsetXSlider.setMinorTickSpacing(1);
this.imageOffsetXSlider.setPaintLabels(true);
this.imageOffsetXSlider.setToolTipText("Background image horizontal offset (X)");
this.imageOffsetXSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
imageOffsetPanel.add(this.imageOffsetXSlider);
this.imageOffsetYSlider = new JSlider(JSlider.HORIZONTAL, -200, 200, 0);
this.imageOffsetYSlider.setMajorTickSpacing(100);
this.imageOffsetXSlider.setMinorTickSpacing(1);
this.imageOffsetYSlider.setPaintLabels(true);
this.imageOffsetYSlider.setToolTipText("Background image vertical offset (Y)");
this.imageOffsetYSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
imageOffsetPanel.add(this.imageOffsetYSlider);
//-- Annotation offset panel ----------------------------------------------
JPanel offsetPanel = new JPanel(new GridLayout(0, 1, 0, 0));
offsetPanel.setBorder(
new CompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), new TitledBorder("Draw offset")));
this.offsetXSlider = new JSlider(JSlider.HORIZONTAL, -200, 200, 0);
this.offsetXSlider.setMajorTickSpacing(100);
this.offsetXSlider.setMinorTickSpacing(1);
this.offsetXSlider.setPaintLabels(true);
this.offsetXSlider.setToolTipText("Annotation horizontal offset (X)");
this.offsetXSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
offsetPanel.add(this.offsetXSlider);
this.offsetYSlider = new JSlider(JSlider.HORIZONTAL, 0, 200, 0);
this.offsetYSlider.setMajorTickSpacing(100);
this.offsetYSlider.setMinorTickSpacing(1);
this.offsetYSlider.setPaintLabels(true);
this.offsetYSlider.setToolTipText("Annotation vertical offset (Y)");
this.offsetYSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
offsetPanel.add(this.offsetYSlider);
//-- Annotation distance scalling panel ---------------------------------------
JPanel distancePanel = new JPanel(new GridLayout(0, 1, 0, 0));
distancePanel.setBorder(
new CompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), new TitledBorder("Distance min/max scale and opacity")));
this.distanceMinScaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 30, 10);
this.distanceMinScaleSlider.setMajorTickSpacing(10);
this.distanceMinScaleSlider.setMinorTickSpacing(1);
this.distanceMinScaleSlider.setPaintLabels(true);
this.distanceMinScaleSlider.setToolTipText("Minimum scale 1/10th");
this.distanceMinScaleSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
distancePanel.add(this.distanceMinScaleSlider);
this.distanceMaxScaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 30, 10);
this.distanceMaxScaleSlider.setMajorTickSpacing(10);
this.distanceMaxScaleSlider.setMinorTickSpacing(1);
this.distanceMaxScaleSlider.setPaintLabels(true);
this.distanceMaxScaleSlider.setToolTipText("Maximum scale 1/10th");
this.distanceMaxScaleSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
distancePanel.add(this.distanceMaxScaleSlider);
this.distanceMinOpacitySlider = new JSlider(JSlider.HORIZONTAL, 0, 10, 10);
this.distanceMinOpacitySlider.setMajorTickSpacing(1);
this.distanceMinOpacitySlider.setPaintLabels(true);
this.distanceMinOpacitySlider.setToolTipText("Minimum opacity");
this.distanceMinOpacitySlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
distancePanel.add(this.distanceMinOpacitySlider);
//-- Highlight scale panel ---------------------------------------
JPanel highlightPanel = new JPanel(new GridLayout(0, 1, 0, 0));
highlightPanel.setBorder(
new CompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), new TitledBorder("Highlight scale")));
this.highlightScaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 30, 10);
this.highlightScaleSlider.setMajorTickSpacing(10);
this.highlightScaleSlider.setMinorTickSpacing(1);
this.highlightScaleSlider.setPaintLabels(true);
this.highlightScaleSlider.setToolTipText("Highlight scale 1/10th");
this.highlightScaleSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent event)
{
JSlider s = (JSlider)event.getSource();
if (currentAnnotation != null)
{
updateAnnotation();
}
}
});
highlightPanel.add(this.highlightScaleSlider);
// -- Color panel -------------------------------------------------------
final JPanel colorPanel = new JPanel(new GridLayout(0, 3, 5, 5));
colorPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
colorPanel.add(new JLabel("Text color:"));
this.btTextColor = new JButton("");
this.btTextColor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
Color c = JColorChooser.showDialog(colorPanel,
"Choose a color...", ((JButton)event.getSource()).getBackground());
if (c != null)
{
((JButton)event.getSource()).setBackground(c);
if(currentAnnotation != null)
updateAnnotation();
}
}
});
colorPanel.add(this.btTextColor);
this.cbTextColorAlpha = new JComboBox(new String[] {"10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "0"});
this.cbTextColorAlpha.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
if(currentAnnotation != null)
{
updateAnnotation();
}
}
});
colorPanel.add(this.cbTextColorAlpha);
colorPanel.add(new JLabel("Back color:"));
this.btBackColor = new JButton("");
this.btBackColor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
Color c = JColorChooser.showDialog(colorPanel,
"Choose a color...", ((JButton)event.getSource()).getBackground());
if (c != null)
{
((JButton)event.getSource()).setBackground(c);
if(currentAnnotation != null)
updateAnnotation();
}
}
});
colorPanel.add(this.btBackColor);
this.cbBackColorAlpha = new JComboBox(new String[] {"10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "0"});
this.cbBackColorAlpha.addActionListener(new ActionListene
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -