use of org.myrobotlab.swing.widget.FileChooser in project myrobotlab by MyRobotLab.
the class ArduinoGui method addMrlCommPanel.
public void addMrlCommPanel() {
JPanel uploadPanel = new JPanel(new BorderLayout());
String pathToMrlComm = null;
String mrlIno = null;
try {
pathToMrlComm = "resource/Arduino/MrlComm/MrlComm.ino";
mrlIno = FileIO.toString(pathToMrlComm);
} catch (Exception e) {
}
try {
if (mrlIno == null) {
pathToMrlComm = "src/resource/Arduino/MrlComm/MrlComm.ino";
mrlIno = FileIO.toString(pathToMrlComm);
}
} catch (Exception e) {
}
GridBagConstraints gc = new GridBagConstraints();
gc.gridx = 0;
gc.gridy = 0;
JPanel top = new JPanel(new GridBagLayout());
top.add(new JLabel("Arduino IDE Path "), gc);
gc.gridx++;
top.add(arduinoPath, gc);
gc.gridx++;
if (chooser == null) {
chooser = new FileChooser("browse", arduinoPath);
chooser.filterDirsOnly();
}
top.add(chooser, gc);
gc.gridx++;
top.add(openMrlComm, gc);
gc.gridx++;
top.add(uploadMrlComm, gc);
gc.gridx++;
gc.gridx = 0;
gc.gridy = 1;
gc.gridwidth = 2;
top.add(new JLabel("MrlComm.ino location "), gc);
gc.gridx += 2;
top.add(new JLabel(pathToMrlComm), gc);
uploadPanel.add(top, BorderLayout.NORTH);
editor = new TextEditorPane();
// editor.setPreferredSize(new Dimension(500, 400));
editor.setText(mrlIno);
editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_CPLUSPLUS);
editor.setCodeFoldingEnabled(true);
editor.setAntiAliasingEnabled(true);
editor.setEnabled(false);
editor.setReadOnly(true);
RTextScrollPane pane = new RTextScrollPane(editor);
pane.setPreferredSize(new Dimension(500, 400));
uploadPanel.add(pane, BorderLayout.CENTER);
JScrollPane pane2 = new JScrollPane(uploadResults);
uploadPanel.add(pane2, BorderLayout.SOUTH);
localTabs.addTab("upload", uploadPanel);
}
Aggregations