本文整理汇总了Java中com.cburch.logisim.proj.Project类的典型用法代码示例。如果您正苦于以下问题:Java Project类的具体用法?Java Project怎么用?Java Project使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Project类属于com.cburch.logisim.proj包,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LogisimMenuBar
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
public LogisimMenuBar(JFrame parent, Project proj) {
this.parent = parent;
this.listener = new MyListener();
this.proj = proj;
this.enableListeners = new ArrayList<ChangeListener>();
add(file = new MenuFile(this));
add(edit = new MenuEdit(this));
add(project = new MenuProject(this));
add(simulate = new MenuSimulate(this));
add(new WindowMenu(parent));
add(help = new MenuHelp(this));
LocaleManager.addLocaleListener(listener);
listener.localeChanged();
}
示例2: doLoadBuiltinLibrary
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
public static void doLoadBuiltinLibrary(Project proj) {
LogisimFile file = proj.getLogisimFile();
List<Library> baseBuilt = file.getLoader().getBuiltin().getLibraries();
ArrayList<Library> builtins = new ArrayList<Library>(baseBuilt);
builtins.removeAll(file.getLibraries());
if (builtins.isEmpty()) {
JOptionPane.showMessageDialog(proj.getFrame(), Strings.get("loadBuiltinNoneError"),
Strings.get("loadBuiltinErrorTitle"), JOptionPane.INFORMATION_MESSAGE);
return;
}
LibraryJList list = new LibraryJList(builtins);
JScrollPane listPane = new JScrollPane(list);
int action = JOptionPane.showConfirmDialog(proj.getFrame(), listPane, Strings.get("loadBuiltinDialogTitle"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (action == JOptionPane.OK_OPTION) {
Library[] libs = list.getSelectedLibraries();
if (libs != null)
proj.doAction(LogisimFileActions.loadLibraries(libs));
}
}
示例3: computeDxDy
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
private void computeDxDy(Project proj, MouseEvent e, Graphics g) {
Bounds bds = proj.getSelection().getBounds(g);
int dx;
int dy;
if (bds == Bounds.EMPTY_BOUNDS) {
dx = e.getX() - start.getX();
dy = e.getY() - start.getY();
} else {
dx = Math.max(e.getX() - start.getX(), -bds.getX());
dy = Math.max(e.getY() - start.getY(), -bds.getY());
}
Selection sel = proj.getSelection();
if (sel.shouldSnap()) {
dx = Canvas.snapXToGrid(dx);
dy = Canvas.snapYToGrid(dy);
}
curDx = dx;
curDy = dy;
}
示例4: CircuitJList
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
public CircuitJList(Project proj, boolean includeEmpty) {
LogisimFile file = proj.getLogisimFile();
Circuit current = proj.getCurrentCircuit();
Vector<Circuit> options = new Vector<Circuit>();
boolean currentFound = false;
for (Circuit circ : file.getCircuits()) {
if (!includeEmpty || circ.getBounds() != Bounds.EMPTY_BOUNDS) {
if (circ == current)
currentFound = true;
options.add(circ);
}
}
setListData(options);
if (currentFound)
setSelectedValue(current, true);
setVisibleRowCount(Math.min(6, options.size()));
}
示例5: SimulationExplorer
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
SimulationExplorer(Project proj, MenuListener menu) {
super(new BorderLayout());
this.project = proj;
SimulationToolbarModel toolbarModel = new SimulationToolbarModel(proj, menu);
Toolbar toolbar = new Toolbar(toolbarModel);
add(toolbar, BorderLayout.NORTH);
model = new SimulationTreeModel(proj.getSimulator().getCircuitState());
model.setCurrentView(project.getCircuitState());
tree = new JTree(model);
tree.setCellRenderer(new SimulationTreeRenderer());
tree.addMouseListener(this);
tree.setToggleClickCount(3);
add(new JScrollPane(tree), BorderLayout.CENTER);
proj.addProjectListener(this);
}
示例6: DataPoker
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
private DataPoker(InstanceState state, MemState data, long addr) {
data.setCursor(addr);
initValue = data.getContents().get(data.getCursor());
curValue = initValue;
Object attrs = state.getInstance().getAttributeSet();
if (attrs instanceof RomAttributes) {
Project proj = state.getProject();
if (proj != null) {
((RomAttributes) attrs).setProject(proj);
}
}
}
示例7: mouseClicked
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
if (contents == null)
return;
Project proj = source instanceof Frame ? ((Frame) source).getProject() : null;
HexFrame frame = RomAttributes.getHexFrame(contents, proj);
frame.setVisible(true);
frame.toFront();
}
示例8: LogFrame
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
public LogFrame(Project project) {
this.project = project;
this.windowManager = new WindowMenuManager();
project.addProjectListener(myListener);
project.addLibraryListener(myListener);
setDefaultCloseOperation(HIDE_ON_CLOSE);
setJMenuBar(new LogisimMenuBar(this, project));
setSimulator(project.getSimulator(), project.getCircuitState());
panels = new LogPanel[] { new SelectionPanel(this), new ScrollPanel(this), new FilePanel(this), };
tabbedPane = new JTabbedPane();
for (int index = 0; index < panels.length; index++) {
LogPanel panel = panels[index];
tabbedPane.addTab(panel.getTitle(), null, panel, panel.getToolTipText());
}
JPanel buttonPanel = new JPanel();
buttonPanel.add(clearLog);
clearLog.addActionListener(myListener);
Container contents = getContentPane();
tabbedPane.setPreferredSize(new Dimension(450, 300));
contents.add(tabbedPane, BorderLayout.CENTER);
contents.add(buttonPanel, BorderLayout.SOUTH);
LocaleManager.addLocaleListener(myListener);
myListener.localeChanged();
pack();
setLocationRelativeTo(null);
}
示例9: register
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
static void register(MemContents value, Project proj) {
if (proj == null || listenerRegistry.containsKey(value))
return;
RomContentsListener l = new RomContentsListener(proj);
value.addHexModelListener(l);
listenerRegistry.put(value, l);
}
示例10: configureAnalyzer
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
private static void configureAnalyzer(Project proj, Circuit circuit, Analyzer analyzer,
Map<Instance, String> pinNames, ArrayList<String> inputNames, ArrayList<String> outputNames) {
analyzer.getModel().setVariables(inputNames, outputNames);
// If there are no inputs, we stop with that tab selected
if (inputNames.size() == 0) {
analyzer.setSelectedTab(Analyzer.INPUTS_TAB);
return;
}
// If there are no outputs, we stop with that tab selected
if (outputNames.size() == 0) {
analyzer.setSelectedTab(Analyzer.OUTPUTS_TAB);
return;
}
// Attempt to show the corresponding expression
Analyze.computeTable(analyzer.getModel(), proj, circuit, pinNames);
analyzer.setSelectedTab(Analyzer.TABLE_TAB);
// nothing to do, stupid useless code
/*
* try { Analyze.computeExpression(analyzer.getModel(), circuit, pinNames); }
* catch (AnalyzeException ex) { // As a backup measure, we compute a truth
* table. Analyze.computeTable(analyzer.getModel(), proj, circuit, pinNames);
*
* /* System.out.println(ex.getMessage());
* JOptionPane.showMessageDialog(proj.getFrame(), ex.getMessage(),
* Strings.get("analyzeNoExpressionTitle"), JOptionPane.INFORMATION_MESSAGE);
*/
/*
* } finally { analyzer.setSelectedTab(Analyzer.TABLE_TAB); }
*/
}
示例11: getCellEditor
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
@Override
public java.awt.Component getCellEditor(Window source, MemContents value) {
if (source instanceof Frame) {
Project proj = ((Frame) source).getProject();
RomAttributes.register(value, proj);
}
ContentsCell ret = new ContentsCell(source, value);
ret.mouseClicked(null);
return ret;
}
示例12: actionPerformed
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
Project proj = menubar.getProject();
if (src == newi) {
ProjectActions.doNew(proj);
} else if (src == open) {
ProjectActions.doOpen(proj == null ? null : proj.getFrame().getCanvas(), proj);
} else if (src == close) {
Frame frame = proj.getFrame();
if (frame.confirmClose()) {
frame.dispose();
OptionsFrame f = proj.getOptionsFrame(false);
if (f != null)
f.dispose();
}
} else if (src == save) {
ProjectActions.doSave(proj);
} else if (src == saveAs) {
ProjectActions.doSaveAs(proj, true);
} else if (src == exportllo) {
ProjectActions.doSaveAs(proj, false);
} else if (src == prefs) {
PreferencesFrame.showPreferences();
} else if (src == quit) {
ProjectActions.doQuit();
}
}
示例13: configureMenu
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
@Override
public void configureMenu(JPopupMenu menu, Project proj) {
this.circState = proj.getCircuitState();
boolean enabled = circState != null;
this.edit = createItem(enabled, Strings.get("ramEditMenuItem"));
this.reset = createItem(enabled, Strings.get("ramClearMenuItem"));
menu.addSeparator();
menu.add(this.edit);
menu.add(this.reset);
}
示例14: projectChanged
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
@Override
public void projectChanged(ProjectEvent e) {
Project proj = menubar.getProject();
Action last = proj == null ? null : proj.getLastAction();
if (last == null) {
undo.setText(Strings.get("editCantUndoItem"));
undo.setEnabled(false);
} else {
undo.setText(StringUtil.format(Strings.get("editUndoItem"), last.getName()));
undo.setEnabled(true);
}
}
示例15: undo
import com.cburch.logisim.proj.Project; //导入依赖的package包/类
@Override
public void undo(Project proj) {
if (remove) {
canvasModel.addObjects(affected);
canvas.getSelection().clearSelected();
canvas.getSelection().setSelected(affected.keySet(), true);
}
Clipboard.set(oldClipboard);
}