final JButton huntButt = new JButton();
huntButt.setAction(new AbstractAction("Hunt") {
public void actionPerformed(ActionEvent e) {
huntButt.setEnabled(false);
Thread t = new ZDefaultThread("MidiManager Hunt") {
public void run() {
try {
Zoeos.getInstance().getDeviceManager().performHunt();
} finally {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
huntButt.setEnabled(true);
}
});
}
}
};
t.start();
}
});
huntButt.setAlignmentX(Component.LEFT_ALIGNMENT);
huntButt.setToolTipText("Hunt For Devices");
/*final JButton permitButt = new JButton();
permitButt.setAction(new AbstractAction("Modify Port Ignore Tokens") {
public void actionPerformed(ActionEvent e) {
if ( editIgnoreTokensDlg == null)
editIgnoreTokensDlg = new ZEditIgnoreTokensDialog(ZoeosFrame.getInstance(), false);
editIgnoreTokensDlg.show();
}
});
permitButt.setToolTipText("Specify which ports ZoeOS is permitted to use");
*/
final JButton permitButt = new JButton();
permitButt.setAction(new AbstractAction("Permit") {
public void actionPerformed(ActionEvent e) {
int[] selRows = midiManagerTable.getSelectedRows();
for (int i = 0,j = selRows.length; i < j; i++) {
Object tok = midiManagerTable.getModel().getValueAt(selRows[i], 0);
if (tok != null && !tok.equals(""))
MidiSystemFacade.getInstance().removeIgnoreToken(tok);
}
}
});
permitButt.setToolTipText("Permit selected ports");
final JButton ignoreButt = new JButton();
ignoreButt.setAction(new AbstractAction("Ignore") {
public void actionPerformed(ActionEvent e) {
int[] selRows = midiManagerTable.getSelectedRows();
for (int i = 0,j = selRows.length; i < j; i++) {
Object tok = midiManagerTable.getModel().getValueAt(selRows[i], 0);
if (tok != null && !tok.equals(""))
MidiSystemFacade.getInstance().addIgnoreToken(tok);
}
}
});
ignoreButt.setToolTipText("Ignore selected ports");
final JButton permitAllButt = new JButton();
permitAllButt.setAction(new AbstractAction("Permit All") {
public void actionPerformed(ActionEvent e) {
MidiSystemFacade.getInstance().clearIgnoreTokens();
}
});
permitAllButt.setToolTipText("Permit all ports");
relCheck = new JCheckBox(new AbstractAction("Release Midi when Application Minimized (Stop Devices)") {
public void actionPerformed(ActionEvent e) {
ZoeosPreferences.ZPREF_releaseMidiOnMinimize.putValue(relCheck.isSelected());
}
});
relCheck.setSelected(ZoeosPreferences.ZPREF_releaseMidiOnMinimize.getValue());
JPanel bottomPanel = new JPanel() {
public Color getBackground() {
return UIColors.getDefaultBG();
}
public Color getForeground() {
return UIColors.getDefaultFG();
}
};
bottomPanel.setLayout(new BorderLayout());
JPanel bp1 = new JPanel();
bp1.add(relCheck);
bp1.setLayout(new FlowLayout(FlowLayout.LEFT));
JPanel bp2 = new JPanel();
bp2.setLayout(new FlowLayout(FlowLayout.LEFT));
bp2.add(hideButt);
bp2.add(huntButt);
bp2.add(permitButt);
bp2.add(ignoreButt);
bp2.add(permitAllButt);
bottomPanel.add(bp1, BorderLayout.NORTH);
bottomPanel.add(bp2, BorderLayout.CENTER);
AbstractAction ract = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
if (e.getSource() instanceof Component) {
((Component) e.getSource()).setEnabled(false);
new ZDefaultThread("Refresh Midi") {
public void run() {
try {
//MidiSystemFacade.getInstance().refresh(true);
} finally {
SwingUtilities.invokeLater(new Runnable() {