|
|
|
@ -1,5 +1,11 @@
@@ -1,5 +1,11 @@
|
|
|
|
|
package de.srsoftware.belegscanner.gui; |
|
|
|
|
|
|
|
|
|
import java.awt.Desktop; |
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
import javax.swing.BoxLayout; |
|
|
|
|
import javax.swing.JLabel; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
@ -8,6 +14,8 @@ import javax.swing.border.EmptyBorder;
@@ -8,6 +14,8 @@ import javax.swing.border.EmptyBorder;
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
import de.srsoftware.belegscanner.Application; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Simple status barwith updateable text. |
|
|
|
|
* This class may be extended to show more status information. |
|
|
|
@ -25,8 +33,24 @@ public class StatusBar extends JPanel {
@@ -25,8 +33,24 @@ public class StatusBar extends JPanel {
|
|
|
|
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
|
|
|
|
add(path = new JLabel("Kein Pfad gewält.")); |
|
|
|
|
path.setBorder(new EmptyBorder(5,5,5,5)); |
|
|
|
|
path.setToolTipText(Application.t("Click here to open directory")); |
|
|
|
|
path.addMouseListener(new MouseAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
|
openDir(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void openDir() { |
|
|
|
|
try { |
|
|
|
|
File dir = new File(path.getText()); |
|
|
|
|
if (dir.exists()) Desktop.getDesktop().open(dir); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public StatusBar setPath(String path) { |
|
|
|
|
LOG.debug("setPath({})",path); |
|
|
|
|
this.path.setText(path); |
|
|
|
|