mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
Library inserts element if it is imported, added icons
This commit is contained in:
parent
b858d72fd5
commit
802d5c83a6
@ -54,7 +54,11 @@ public class LibrarySelector implements ElementNotFoundNotification {
|
|||||||
JFileChooser fc = new JFileChooser(filePath);
|
JFileChooser fc = new JFileChooser(filePath);
|
||||||
fc.addChoosableFileFilter(new FileNameExtensionFilter("Circuit", "dig"));
|
fc.addChoosableFileFilter(new FileNameExtensionFilter("Circuit", "dig"));
|
||||||
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
|
||||||
importElement(fc.getSelectedFile());
|
ElementTypeDescription des = importElement(fc.getSelectedFile());
|
||||||
|
if (des != null) {
|
||||||
|
VisualElement visualElement = new VisualElement(des.getName()).setPos(new Vector(10, 10)).setShapeFactory(shapeFactory);
|
||||||
|
circuitComponent.setPartToDrag(visualElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_import_tt")));
|
}.setToolTip(Lang.get("menu_import_tt")));
|
||||||
|
@ -67,8 +67,9 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
|||||||
|
|
||||||
public Main(Component parent, File fileToOpen, SavedListener savedListener) {
|
public Main(Component parent, File fileToOpen, SavedListener savedListener) {
|
||||||
super(Lang.get("digital"));
|
super(Lang.get("digital"));
|
||||||
this.savedListener = savedListener;
|
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
|
setIconImages(IconCreator.createImages("icon32.png", "icon64.png", "icon128.png"));
|
||||||
|
this.savedListener = savedListener;
|
||||||
|
|
||||||
library = new ElementLibrary();
|
library = new ElementLibrary();
|
||||||
shapeFactory = new ShapeFactory(library);
|
shapeFactory = new ShapeFactory(library);
|
||||||
@ -103,7 +104,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
|||||||
|
|
||||||
JMenuBar bar = new JMenuBar();
|
JMenuBar bar = new JMenuBar();
|
||||||
|
|
||||||
|
|
||||||
ToolTipAction newFile = new ToolTipAction(Lang.get("menu_new"), iconNew) {
|
ToolTipAction newFile = new ToolTipAction(Lang.get("menu_new"), iconNew) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user