mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-22 00:32:08 +00:00
Show different backgrounds for different disks while prototyping
This commit is contained in:
parent
4c39d06c34
commit
4fd53b91e1
@ -1,15 +1,24 @@
|
||||
package com.webcodepro.applecommander.ui.swing;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class DiskExplorer extends JPanel {
|
||||
|
||||
public DiskExplorer() {
|
||||
this.setBackground(Color.GREEN);
|
||||
this.setBackground(randomColor());
|
||||
}
|
||||
|
||||
private Color randomColor() {
|
||||
Color colors[] = {Color.black, Color.blue, Color.cyan,
|
||||
Color.gray, Color.darkGray, Color.green,
|
||||
Color.lightGray, Color.magenta, Color.orange,
|
||||
Color.pink,Color.red, Color.white, Color.yellow};
|
||||
return colors[(int)(Math.random() * colors.length)];
|
||||
}
|
||||
/**
|
||||
* serialVersionUID, to keep Eclipse happy
|
||||
*/
|
||||
|
@ -177,14 +177,17 @@ public class SwingAppleCommander extends JFrame implements ActionListener {
|
||||
if (rc == 0) {
|
||||
userPreferences.setDiskImageDirectory(jc.getSelectedFile().getParent());
|
||||
UserPreferences.getInstance().save();
|
||||
if (tabPane.getTitleAt(0).equals(textBundle.get("SwtAppleCommander.AppleCommander"))) {
|
||||
tabPane.remove(0);
|
||||
}
|
||||
tabPane.add(jc.getSelectedFile().getName(),new DiskExplorer());
|
||||
tabPane.setSelectedIndex(tabPane.getTabCount()-1);
|
||||
addDiskExplorerTab(jc.getSelectedFile());
|
||||
}
|
||||
}
|
||||
|
||||
protected void addDiskExplorerTab(File file) {
|
||||
if (tabPane.getTitleAt(0).equals(textBundle.get("SwtAppleCommander.AppleCommander"))) {
|
||||
tabPane.remove(0);
|
||||
}
|
||||
tabPane.add(file.getName(),new DiskExplorer());
|
||||
tabPane.setSelectedIndex(tabPane.getTabCount()-1);
|
||||
}
|
||||
/**
|
||||
* Close a file.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user