You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
package de.srsoftware.belegscanner.gui; |
|
|
|
import javax.swing.*; |
|
import java.awt.*; |
|
|
|
import static de.srsoftware.belegscanner.Application.t; |
|
import static java.awt.BorderLayout.CENTER; |
|
import static java.awt.BorderLayout.NORTH; |
|
import static java.awt.BorderLayout.WEST; |
|
|
|
public class ResolutionSelector extends JPanel{ |
|
|
|
private int resolution = 150; |
|
|
|
public ResolutionSelector() { |
|
super(new BorderLayout()); |
|
ButtonGroup group = new ButtonGroup(); |
|
JLabel label = new JLabel(t("current resolution") + ": " + resolution + "px"); |
|
add(label, NORTH); |
|
add(resolutionButton(group, label, 150), WEST); |
|
add(resolutionButton(group, label, 300), CENTER); |
|
add(resolutionButton(group, label, 600), BorderLayout.EAST); |
|
setMaximumSize(new Dimension(600, 200)); |
|
} |
|
|
|
public int resolutiion(){ |
|
return resolution; |
|
} |
|
|
|
/** |
|
* create one radio button for the resoultionSelector |
|
* @param group |
|
* @param label |
|
* @param i |
|
* @return |
|
*/ |
|
private JRadioButton resolutionButton(ButtonGroup group, JLabel label, int i) { |
|
JRadioButton btn = new JRadioButton(i+" px"); |
|
btn.addActionListener(ev -> { |
|
resolution = i; |
|
label.setText("aktuelle Auflösung: "+resolution+"px"); |
|
}); |
|
group.add(btn); |
|
if (i==150) btn.setSelected(true); |
|
return btn; |
|
} |
|
}
|
|
|