use of javax.swing.JProgressBar in project zaproxy by zaproxy.
the class SplashScreen method getLoadingJProgressBar.
private JProgressBar getLoadingJProgressBar() {
if (loadProgressBar == null) {
loadProgressBar = new JProgressBar();
loadProgressBar.setPreferredSize(DisplayUtils.getScaledDimension(100, 12));
loadProgressBar.setMinimum(0);
loadProgressBar.setMaximum(100);
loadProgressBar.setValue(50);
loadProgressBar.setBorder(BorderFactory.createLineBorder(Color.black));
loadProgressBar.setUI(new CustomProgressBarUI());
loadProgressBar.setForeground(Color.decode("#4389FF"));
setLoadingCompletion(0.0D);
}
return loadProgressBar;
}
use of javax.swing.JProgressBar in project logisim-evolution by reds-heig.
the class AlteraDownload method Download.
public static boolean Download(String scriptPath, String ProjectPath, String SandboxPath, FPGAReport MyReporter) {
VendorSoftware alteraVendor = VendorSoftware.getSoftware(VendorSoftware.VendorAltera);
boolean SofFileExists = new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".sof").exists();
GridBagConstraints gbc = new GridBagConstraints();
JFrame panel = new JFrame("Altera Downloading");
panel.setResizable(false);
panel.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
GridBagLayout thisLayout = new GridBagLayout();
panel.setLayout(thisLayout);
// PointerInfo mouseloc = MouseInfo.getPointerInfo();
// Point mlocation = mouseloc.getLocation();
// panel.setLocation(mlocation.x, mlocation.y);
JLabel LocText = new JLabel("Generating FPGA files and performing download; this may take a while");
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(LocText, gbc);
JProgressBar progres = new JProgressBar(0, 5);
progres.setValue(1);
progres.setStringPainted(true);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progres, gbc);
panel.pack();
panel.setLocation(Projects.getCenteredLoc(panel.getWidth(), panel.getHeight() * 4));
panel.setVisible(true);
Rectangle labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
List<String> command = new ArrayList<String>();
if (!SofFileExists) {
try {
LocText.setText("Creating Project");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
command.add(alteraVendor.getBinaryPath(0));
command.add("-t");
command.add(scriptPath.replace(ProjectPath, ".." + File.separator) + "AlteraDownload.tcl");
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to Create a Quartus Project, cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
}
progres.setValue(2);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
if (!SofFileExists) {
try {
LocText.setText("Optimize Project");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
command.add(alteraVendor.getBinaryPath(2));
command.add(ToplevelHDLGeneratorFactory.FPGAToplevelName);
command.add("--optimize=area");
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to optimize (AREA) Project, cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
}
LocText.setText("Synthesizing and creating configuration file (this may take a while)");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(3);
ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
if (!SofFileExists) {
try {
command.clear();
command.add(alteraVendor.getBinaryPath(0));
command.add("--flow");
command.add("compile");
command.add(ToplevelHDLGeneratorFactory.FPGAToplevelName);
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to synthesize design and to create the configuration files, cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
}
LocText.setText("Downloading");
Object[] options = { "Yes, download", "No, abort" };
if (JOptionPane.showOptionDialog(progres, "Verify that your board is connected and you are ready to download.", "Ready to download ?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) != JOptionPane.YES_OPTION) {
MyReporter.AddWarning("Download aborted.");
panel.dispose();
return false;
}
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(4);
ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
try {
command.clear();
command.add(alteraVendor.getBinaryPath(1));
command.add("-c");
command.add("usb-blaster");
command.add("-m");
command.add("jtag");
command.add("-o");
// if there is no .sof generated, try with the .pof
if (new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".sof").exists()) {
command.add("P;" + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".sof");
} else {
command.add("P;" + ToplevelHDLGeneratorFactory.FPGAToplevelName + ".pof");
}
MyReporter.AddInfo(command.toString());
ProcessBuilder Altera1 = new ProcessBuilder(command);
Altera1.directory(new File(SandboxPath));
final Process CreateProject = Altera1.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to Download design; did you connect the board?");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Altera download");
panel.dispose();
return false;
}
panel.dispose();
return true;
}
use of javax.swing.JProgressBar in project logisim-evolution by reds-heig.
the class XilinxDownload method Download.
public static boolean Download(BoardInformation BoardInfo, String scriptPath, String UcfPath, String ProjectPath, String SandboxPath, FPGAReport MyReporter) {
VendorSoftware xilinxVendor = VendorSoftware.getSoftware(VendorSoftware.VendorXilinx);
boolean IsCPLD = BoardInfo.fpga.getPart().toUpperCase().startsWith("XC2C") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XA2C") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XCR3") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XC9500") || BoardInfo.fpga.getPart().toUpperCase().startsWith("XA9500");
String BitfileExt = (IsCPLD) ? "jed" : "bit";
boolean BitFileExists = new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + "." + BitfileExt).exists();
GridBagConstraints gbc = new GridBagConstraints();
JFrame panel = new JFrame("Xilinx Downloading");
panel.setResizable(false);
panel.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
GridBagLayout thisLayout = new GridBagLayout();
panel.setLayout(thisLayout);
// PointerInfo mouseloc = MouseInfo.getPointerInfo();
// Point mlocation = mouseloc.getLocation();
// panel.setLocation(mlocation.x,mlocation.y);
JLabel LocText = new JLabel("Generating FPGA files and performing download; this may take a while");
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(LocText, gbc);
JProgressBar progres = new JProgressBar(0, xilinxVendor.getBinaries().length);
progres.setValue(0);
progres.setStringPainted(true);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progres, gbc);
panel.pack();
panel.setLocation(Projects.getCenteredLoc(panel.getWidth(), panel.getHeight() * 4));
panel.setVisible(true);
Rectangle labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
List<String> command = new ArrayList<String>();
if (!BitFileExists) {
try {
LocText.setText("Synthesizing Project");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
command.add(xilinxVendor.getBinaryPath(0));
command.add("-ifn");
command.add(scriptPath.replace(ProjectPath, "../") + File.separator + script_file);
command.add("-ofn");
command.add("logisim.log");
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to Synthesize Xilinx project; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists) {
try {
LocText.setText("Adding contraints");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(1);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
command.add(xilinxVendor.getBinaryPath(1));
command.add("-intstyle");
command.add("ise");
command.add("-uc");
command.add(UcfPath.replace(ProjectPath, "../") + File.separator + ucf_file);
command.add("logisim.ngc");
command.add("logisim.ngd");
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to add Xilinx constraints; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists && !IsCPLD) {
try {
LocText.setText("Mapping Design");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(2);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
command.add(xilinxVendor.getBinaryPath(2));
command.add("-intstyle");
command.add("ise");
command.add("-o");
command.add("logisim_map");
command.add("logisim.ngd");
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to map Xilinx design; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists) {
try {
LocText.setText("Place and routing Design");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(3);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
if (!IsCPLD) {
command.add(xilinxVendor.getBinaryPath(3));
command.add("-w");
command.add("-intstyle");
command.add("ise");
command.add("-ol");
command.add("high");
command.add("logisim_map");
command.add("logisim_par");
command.add("logisim_map.pcf");
} else {
command.add(xilinxVendor.getBinaryPath(6));
command.add("-p");
command.add(BoardInfo.fpga.getPart().toUpperCase() + "-" + BoardInfo.fpga.getSpeedGrade() + "-" + BoardInfo.fpga.getPackage().toUpperCase());
command.add("-intstyle");
command.add("ise");
/* TODO: do correct termination type */
command.add("-terminate");
if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullUp) {
command.add("pullup");
} else if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullDown) {
command.add("pulldown");
} else {
command.add("float");
}
command.add("-loc");
command.add("on");
command.add("-log");
command.add("logisim_cpldfit.log");
command.add("logisim.ngd");
}
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed to P&R Xilinx design; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
if (!BitFileExists) {
try {
LocText.setText("Generating Bitfile");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(4);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
command.clear();
if (!IsCPLD) {
command.add(xilinxVendor.getBinaryPath(4));
command.add("-w");
if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullUp) {
command.add("-g");
command.add("UnusedPin:PULLUP");
}
if (BoardInfo.fpga.getUnusedPinsBehavior() == PullBehaviors.PullDown) {
command.add("-g");
command.add("UnusedPin:PULLDOWN");
}
command.add("-g");
command.add("StartupClk:CCLK");
command.add("logisim_par");
command.add(ToplevelHDLGeneratorFactory.FPGAToplevelName + ".bit");
} else {
command.add(xilinxVendor.getBinaryPath(7));
command.add("-i");
command.add("logisim.vm6");
}
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed generate bitfile; cannot download");
panel.dispose();
return false;
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
}
try {
LocText.setText("Downloading Bitfile");
labelRect = LocText.getBounds();
labelRect.x = 0;
labelRect.y = 0;
LocText.paintImmediately(labelRect);
progres.setValue(5);
Rectangle ProgRect = progres.getBounds();
ProgRect.x = 0;
ProgRect.y = 0;
progres.paintImmediately(ProgRect);
Object[] options = { "Yes, download", "No, abort" };
if (JOptionPane.showOptionDialog(progres, "Verify that your board is connected and you are ready to download.", "Ready to download ?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]) != JOptionPane.YES_OPTION) {
MyReporter.AddWarning("Download aborted.");
panel.dispose();
return false;
}
/* Until here update of status window */
if (!BoardInfo.fpga.USBTMCDownloadRequired()) {
command.clear();
command.add(xilinxVendor.getBinaryPath(5));
command.add("-batch");
command.add(scriptPath.replace(ProjectPath, "../") + File.separator + download_file);
ProcessBuilder Xilinx = new ProcessBuilder(command);
Xilinx.directory(new File(SandboxPath));
final Process CreateProject = Xilinx.start();
InputStream is = CreateProject.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
MyReporter.ClsScr();
while ((line = br.readLine()) != null) {
MyReporter.print(line);
}
CreateProject.waitFor();
if (CreateProject.exitValue() != 0) {
MyReporter.AddFatalError("Failed in downloading");
panel.dispose();
return false;
}
/* Until here is the standard download with programmer */
} else {
MyReporter.ClsScr();
/* Here we do the USBTMC Download */
boolean usbtmcdevice = new File("/dev/usbtmc0").exists();
if (!usbtmcdevice) {
MyReporter.AddFatalError("Could not find usbtmc device");
panel.dispose();
return false;
}
File bitfile = new File(SandboxPath + ToplevelHDLGeneratorFactory.FPGAToplevelName + "." + BitfileExt);
byte[] bitfile_buffer = new byte[BUFFER_SIZE];
int bitfile_buffer_size;
BufferedInputStream bitfile_in = new BufferedInputStream(new FileInputStream(bitfile));
File usbtmc = new File("/dev/usbtmc0");
BufferedOutputStream usbtmc_out = new BufferedOutputStream(new FileOutputStream(usbtmc));
usbtmc_out.write("FPGA ".getBytes());
bitfile_buffer_size = bitfile_in.read(bitfile_buffer, 0, BUFFER_SIZE);
while (bitfile_buffer_size > 0) {
usbtmc_out.write(bitfile_buffer, 0, bitfile_buffer_size);
bitfile_buffer_size = bitfile_in.read(bitfile_buffer, 0, BUFFER_SIZE);
}
usbtmc_out.close();
bitfile_in.close();
}
} catch (IOException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
} catch (InterruptedException e) {
MyReporter.AddFatalError("Internal Error during Xilinx download");
panel.dispose();
return false;
}
panel.dispose();
return true;
}
use of javax.swing.JProgressBar in project joons-renderer by joonhyublee.
the class SunflowGUI method initGUI.
private void initGUI() {
setTitle("Sunflow v" + SunflowAPI.VERSION);
setDefaultCloseOperation(EXIT_ON_CLOSE);
{
desktop = new JDesktopPane();
getContentPane().add(desktop, BorderLayout.CENTER);
Dimension screenRes = Toolkit.getDefaultToolkit().getScreenSize();
if (screenRes.getWidth() <= DEFAULT_WIDTH || screenRes.getHeight() <= DEFAULT_HEIGHT) {
desktop.setPreferredSize(new java.awt.Dimension(640, 480));
} else {
desktop.setPreferredSize(new java.awt.Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
}
{
imagePanelFrame = new JInternalFrame();
desktop.add(imagePanelFrame);
{
jPanel1 = new JPanel();
FlowLayout jPanel1Layout = new FlowLayout();
jPanel1Layout.setAlignment(FlowLayout.LEFT);
jPanel1.setLayout(jPanel1Layout);
imagePanelFrame.getContentPane().add(jPanel1, BorderLayout.NORTH);
{
renderButton = new JButton();
jPanel1.add(renderButton);
renderButton.setText("Render");
renderButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
renderMenuItemActionPerformed(evt);
}
});
}
{
iprButton = new JButton();
jPanel1.add(iprButton);
iprButton.setText("IPR");
iprButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
iprMenuItemActionPerformed(evt);
}
});
}
}
{
imagePanel = new ImagePanel();
imagePanelFrame.getContentPane().add(imagePanel, BorderLayout.CENTER);
}
imagePanelFrame.pack();
imagePanelFrame.setResizable(true);
imagePanelFrame.setMaximizable(true);
imagePanelFrame.setVisible(true);
imagePanelFrame.setTitle("Image");
imagePanelFrame.setIconifiable(true);
}
{
editorFrame = new JInternalFrame();
desktop.add(editorFrame);
editorFrame.setTitle("Script Editor");
editorFrame.setMaximizable(true);
editorFrame.setResizable(true);
editorFrame.setIconifiable(true);
{
jScrollPane1 = new JScrollPane();
editorFrame.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane1.setPreferredSize(new java.awt.Dimension(360, 280));
{
editorTextArea = new JTextArea();
jScrollPane1.setViewportView(editorTextArea);
editorTextArea.setFont(new java.awt.Font("Monospaced", 0, 12));
// drag and drop
editorTextArea.setTransferHandler(new SceneTransferHandler());
}
}
{
jPanel3 = new JPanel();
editorFrame.getContentPane().add(jPanel3, BorderLayout.SOUTH);
FlowLayout jPanel3Layout = new FlowLayout();
jPanel3Layout.setAlignment(FlowLayout.RIGHT);
jPanel3.setLayout(jPanel3Layout);
{
buildButton = new JButton();
jPanel3.add(buildButton);
buildButton.setText("Build Scene");
buildButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
buildMenuItemActionPerformed(evt);
}
});
}
}
editorFrame.pack();
editorFrame.setVisible(true);
}
{
consoleFrame = new JInternalFrame();
desktop.add(consoleFrame);
consoleFrame.setIconifiable(true);
consoleFrame.setMaximizable(true);
consoleFrame.setResizable(true);
consoleFrame.setTitle("Console");
{
jScrollPane2 = new JScrollPane();
consoleFrame.getContentPane().add(jScrollPane2, BorderLayout.CENTER);
jScrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane2.setPreferredSize(new java.awt.Dimension(360, 100));
{
consoleTextArea = new JTextArea();
jScrollPane2.setViewportView(consoleTextArea);
consoleTextArea.setFont(new java.awt.Font("Monospaced", 0, 12));
consoleTextArea.setEditable(false);
}
}
{
jPanel4 = new JPanel();
consoleFrame.getContentPane().add(jPanel4, BorderLayout.SOUTH);
BorderLayout jPanel4Layout = new BorderLayout();
jPanel4.setLayout(jPanel4Layout);
{
jPanel6 = new JPanel();
BorderLayout jPanel6Layout = new BorderLayout();
jPanel6.setLayout(jPanel6Layout);
jPanel4.add(jPanel6, BorderLayout.CENTER);
jPanel6.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
{
taskProgressBar = new JProgressBar();
jPanel6.add(taskProgressBar);
taskProgressBar.setEnabled(false);
taskProgressBar.setString("");
taskProgressBar.setStringPainted(true);
taskProgressBar.setOpaque(false);
}
}
{
jPanel5 = new JPanel();
FlowLayout jPanel5Layout = new FlowLayout();
jPanel5Layout.setAlignment(FlowLayout.RIGHT);
jPanel5.setLayout(jPanel5Layout);
jPanel4.add(jPanel5, BorderLayout.EAST);
{
taskCancelButton = new JButton();
jPanel5.add(taskCancelButton);
taskCancelButton.setText("Cancel");
taskCancelButton.setEnabled(false);
taskCancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
UI.taskCancel();
}
});
}
{
clearConsoleButton = new JButton();
jPanel5.add(clearConsoleButton);
clearConsoleButton.setText("Clear");
clearConsoleButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
clearConsole();
}
});
}
}
}
consoleFrame.pack();
consoleFrame.setVisible(true);
}
}
{
jMenuBar1 = new JMenuBar();
setJMenuBar(jMenuBar1);
{
fileMenu = new JMenu();
jMenuBar1.add(fileMenu);
fileMenu.setText("File");
{
newFileMenuItem = new JMenuItem();
fileMenu.add(newFileMenuItem);
newFileMenuItem.setText("New");
newFileMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl N"));
newFileMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
newFileMenuItemActionPerformed(evt);
}
});
}
{
openFileMenuItem = new JMenuItem();
fileMenu.add(openFileMenuItem);
openFileMenuItem.setText("Open ...");
openFileMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl O"));
openFileMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
openFileMenuItemActionPerformed(evt);
}
});
}
{
saveMenuItem = new JMenuItem();
fileMenu.add(saveMenuItem);
saveMenuItem.setText("Save");
saveMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl S"));
saveMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
saveCurrentFile(currentFile);
}
});
}
{
saveAsMenuItem = new JMenuItem();
fileMenu.add(saveAsMenuItem);
saveAsMenuItem.setText("Save As ...");
saveAsMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
saveAsMenuItemActionPerformed(evt);
}
});
}
{
jSeparator2 = new JSeparator();
fileMenu.add(jSeparator2);
}
{
exitMenuItem = new JMenuItem();
fileMenu.add(exitMenuItem);
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.exit(0);
}
});
}
}
{
sceneMenu = new JMenu();
jMenuBar1.add(sceneMenu);
sceneMenu.setText("Scene");
{
buildMenuItem = new JMenuItem();
sceneMenu.add(buildMenuItem);
buildMenuItem.setText("Build");
buildMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl B"));
buildMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (sceneMenu.isEnabled()) {
buildMenuItemActionPerformed(evt);
}
}
});
}
{
autoBuildMenuItem = new JCheckBoxMenuItem();
sceneMenu.add(autoBuildMenuItem);
autoBuildMenuItem.setText("Build on open");
autoBuildMenuItem.setSelected(true);
}
{
jSeparator3 = new JSeparator();
sceneMenu.add(jSeparator3);
}
{
renderMenuItem = new JMenuItem();
sceneMenu.add(renderMenuItem);
renderMenuItem.setText("Render");
renderMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
renderMenuItemActionPerformed(evt);
}
});
}
{
iprMenuItem = new JMenuItem();
sceneMenu.add(iprMenuItem);
iprMenuItem.setText("IPR");
iprMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
iprMenuItemActionPerformed(evt);
}
});
}
{
clearLogMenuItem = new JCheckBoxMenuItem();
sceneMenu.add(clearLogMenuItem);
clearLogMenuItem.setText("Auto Clear Log");
clearLogMenuItem.setToolTipText("Clears the console before building or rendering");
clearLogMenuItem.setSelected(true);
}
{
jSeparator4 = new JSeparator();
sceneMenu.add(jSeparator4);
}
{
textureCacheClearMenuItem = new JMenuItem();
sceneMenu.add(textureCacheClearMenuItem);
textureCacheClearMenuItem.setText("Clear Texture Cache");
textureCacheClearMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
textureCacheClearMenuItemActionPerformed(evt);
}
});
}
{
smallTrianglesMenuItem = new JCheckBoxMenuItem();
sceneMenu.add(smallTrianglesMenuItem);
smallTrianglesMenuItem.setText("Low Mem Triangles");
smallTrianglesMenuItem.setToolTipText("Load future meshes using a low memory footprint triangle representation");
smallTrianglesMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
smallTrianglesMenuItemActionPerformed(evt);
}
});
}
}
{
imageMenu = new JMenu();
jMenuBar1.add(imageMenu);
imageMenu.setText("Image");
{
resetZoomMenuItem = new JMenuItem();
imageMenu.add(resetZoomMenuItem);
resetZoomMenuItem.setText("Reset Zoom");
resetZoomMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
imagePanel.reset();
}
});
}
{
fitWindowMenuItem = new JMenuItem();
imageMenu.add(fitWindowMenuItem);
fitWindowMenuItem.setText("Fit to Window");
fitWindowMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
imagePanel.fit();
}
});
}
{
jSeparator1 = new JSeparator();
imageMenu.add(jSeparator1);
}
{
jMenuItem4 = new JMenuItem();
imageMenu.add(jMenuItem4);
jMenuItem4.setText("Save Image ...");
jMenuItem4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
// imagePanel.image;
JFileChooser fc = new JFileChooser(".");
fc.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
return "Image File";
}
@Override
public boolean accept(File f) {
return (f.isDirectory() || f.getName().endsWith(".png") || f.getName().endsWith(".tga"));
}
});
if (fc.showSaveDialog(SunflowGUI.this) == JFileChooser.APPROVE_OPTION) {
String filename = fc.getSelectedFile().getAbsolutePath();
imagePanel.save(filename);
}
}
});
}
}
{
windowMenu = new JMenu();
jMenuBar1.add(windowMenu);
windowMenu.setText("Window");
}
{
imageWindowMenuItem = new JMenuItem();
windowMenu.add(imageWindowMenuItem);
imageWindowMenuItem.setText("Image");
imageWindowMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl 1"));
imageWindowMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
selectFrame(imagePanelFrame);
}
});
}
{
editorWindowMenuItem = new JMenuItem();
windowMenu.add(editorWindowMenuItem);
editorWindowMenuItem.setText("Script Editor");
editorWindowMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl 2"));
editorWindowMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
selectFrame(editorFrame);
}
});
}
{
consoleWindowMenuItem = new JMenuItem();
windowMenu.add(consoleWindowMenuItem);
consoleWindowMenuItem.setText("Console");
consoleWindowMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl 3"));
consoleWindowMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
selectFrame(consoleFrame);
}
});
}
{
jSeparator5 = new JSeparator();
windowMenu.add(jSeparator5);
}
{
tileWindowMenuItem = new JMenuItem();
windowMenu.add(tileWindowMenuItem);
tileWindowMenuItem.setText("Tile");
tileWindowMenuItem.setAccelerator(KeyStroke.getKeyStroke("ctrl T"));
tileWindowMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
tileWindowMenuItemActionPerformed(evt);
}
});
}
}
}
use of javax.swing.JProgressBar in project SKMCLauncher by SKCraft.
the class WebpagePanel method setDocument.
private void setDocument() {
activated = true;
JLayeredPane panel = new JLayeredPane();
panel.setLayout(new WebpageLayoutManager());
documentView = new JEditorPane();
documentView.setEditable(false);
documentView.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e.getURL() != null) {
SwingHelper.openURL(e.getURL(), self);
}
}
}
});
JScrollPane scrollPane = new JScrollPane(documentView);
panel.add(scrollPane, new Integer(1));
progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
panel.add(progressBar, new Integer(2));
add(panel, BorderLayout.CENTER);
}
Aggregations