command line label improved
This commit is contained in:
parent
04ad8605eb
commit
c373b1aa18
@ -292,9 +292,10 @@ public class MainWindow extends JFrame {
|
|||||||
JPanel cmdPanel = new JPanel(new BorderLayout(5, 0));
|
JPanel cmdPanel = new JPanel(new BorderLayout(5, 0));
|
||||||
cmdPanel.setBorder(BorderFactory.createEmptyBorder(2, 5, 0, 5));
|
cmdPanel.setBorder(BorderFactory.createEmptyBorder(2, 5, 0, 5));
|
||||||
|
|
||||||
cmdLabel = new JLabel(System.getProperty("user.name") + ":" + (activePanel != null ? activePanel.getCurrentDirectory().getAbsolutePath() : "") + ">");
|
cmdLabel = new JLabel();
|
||||||
cmdLabel.setFont(new Font("Monospaced", Font.BOLD, 12));
|
cmdLabel.setFont(new Font("Monospaced", Font.BOLD, 12));
|
||||||
cmdPanel.add(cmdLabel, BorderLayout.WEST);
|
cmdPanel.add(cmdLabel, BorderLayout.WEST);
|
||||||
|
updateCommandLinePrompt();
|
||||||
|
|
||||||
commandLine = new JComboBox<>();
|
commandLine = new JComboBox<>();
|
||||||
commandLine.setEditable(true);
|
commandLine.setEditable(true);
|
||||||
@ -1389,12 +1390,17 @@ public class MainWindow extends JFrame {
|
|||||||
|
|
||||||
private void updateCommandLinePrompt() {
|
private void updateCommandLinePrompt() {
|
||||||
if (cmdLabel == null) return;
|
if (cmdLabel == null) return;
|
||||||
|
|
||||||
FilePanel active = activePanel;
|
FilePanel active = activePanel;
|
||||||
if (active == null) return;
|
if (active == null) return;
|
||||||
|
|
||||||
String path = active.getCurrentPath();
|
String path = active.getCurrentPath();
|
||||||
cmdLabel.setText(path + ">");
|
String displayPath = path;
|
||||||
|
if (path.length() > 33) {
|
||||||
|
displayPath = path.substring(0, 15) + "..." + path.substring(path.length() - 15);
|
||||||
|
}
|
||||||
|
cmdLabel.setText(displayPath + ">");
|
||||||
|
cmdLabel.setToolTipText(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user