List of usage examples for javax.swing JButton setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:com.anrisoftware.prefdialog.simpledialog.SimpleDialog.java
private void removeRestoreButton() { JPanel buttonsPanel = dialogPanel.getButtonsPanel(); JButton restoreButton = getRestoreButton(); buttonsPanel.remove(restoreButton);//from www. j av a2 s . c o m buttonsPanel.remove(dialogPanel.getRestoreStrut()); restoreButton.setVisible(false); buttonsPanel.validate(); }
From source file:com.anrisoftware.prefdialog.simpledialog.SimpleDialog.java
private void removeApproveButton() { JPanel buttonsPanel = dialogPanel.getButtonsPanel(); JButton approveButton = getApproveButton(); buttonsPanel.remove(approveButton);/* www . ja va 2s .c o m*/ buttonsPanel.remove(dialogPanel.getApproveStrut()); approveButton.setVisible(false); buttonsPanel.validate(); }
From source file:com.anrisoftware.prefdialog.simpledialog.SimpleDialog.java
private void readdRestoreButton() { JButton cancelButton = getCancelButton(); JButton restoreButton = getRestoreButton(); JPanel buttonsPanel = dialogPanel.getButtonsPanel(); restoreAction.setDialog(this); restoreAction.setTexts(texts);/*from w ww.j av a 2 s .c o m*/ restoreButton.setVisible(true); restoreButton.setAction(restoreAction); buttonsPanel.remove(cancelButton); buttonsPanel.add(restoreButton); buttonsPanel.add(dialogPanel.getRestoreStrut()); buttonsPanel.add(cancelButton); buttonsPanel.validate(); }
From source file:com.anrisoftware.prefdialog.simpledialog.SimpleDialog.java
private void readdApproveButton() { JButton cancelButton = getCancelButton(); JButton approveButton = getApproveButton(); JPanel buttonsPanel = dialogPanel.getButtonsPanel(); approveAction.setDialog(this); approveAction.setTexts(texts);/*from ww w. j a v a2 s .co m*/ approveButton.setVisible(true); approveButton.setAction(approveAction); buttonsPanel.remove(cancelButton); buttonsPanel.add(approveButton); buttonsPanel.add(dialogPanel.getApproveStrut()); buttonsPanel.add(cancelButton); buttonsPanel.validate(); }
From source file:App.java
/** * Initialize the contents of the frame. *//* w w w .jav a 2s. c om*/ private void initialize() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1000, 750); frame.getContentPane().setLayout(null); FileNameExtensionFilter filter = new FileNameExtensionFilter("Image files", "jpg", "jpeg", "png"); fc = new JFileChooser(); fc.setFileFilter(filter); frame.getContentPane().add(fc); stepOne = new JLabel(""); stepOne.setToolTipText("here comes something"); stepOne.setIcon(new ImageIcon("img/stepOne.png")); stepOne.setBounds(266, -4, 67, 49); frame.getContentPane().add(stepOne); btnBrowse = new JButton("Browse"); btnBrowse.setBounds(66, 6, 117, 29); frame.getContentPane().add(btnBrowse); btnTurnWebcamOn = new JButton("Take a picture with webcam"); btnTurnWebcamOn.setBounds(66, 34, 212, 29); frame.getContentPane().add(btnTurnWebcamOn); JButton btnTakePictureWithWebcam = new JButton("Take a picture"); btnTakePictureWithWebcam.setBounds(430, 324, 117, 29); frame.getContentPane().add(btnTakePictureWithWebcam); btnTakePictureWithWebcam.setVisible(false); JButton btnCancel = new JButton("Cancel"); btnCancel.setBounds(542, 324, 117, 29); frame.getContentPane().add(btnCancel); btnCancel.setVisible(false); JButton btnSaveImage = new JButton("Save image"); btnSaveImage.setBounds(497, 357, 117, 29); frame.getContentPane().add(btnSaveImage); btnSaveImage.setVisible(false); urlField = new JTextField(); urlField.setBounds(66, 67, 220, 26); frame.getContentPane().add(urlField); urlField.setColumns(10); originalImageLabel = new JLabel(); originalImageLabel.setHorizontalAlignment(SwingConstants.CENTER); originalImageLabel.setBounds(33, 98, 300, 300); frame.getContentPane().add(originalImageLabel); stepTwo = new JLabel(""); stepTwo.setToolTipText("here comes something else"); stepTwo.setIcon(new ImageIcon("img/stepTwo.png")); stepTwo.setBounds(266, 413, 67, 49); frame.getContentPane().add(stepTwo); btnAnalyse = new JButton("Analyse image"); btnAnalyse.setBounds(68, 423, 196, 29); frame.getContentPane().add(btnAnalyse); tagsField = new JTextArea(); tagsField.setBounds(23, 479, 102, 89); tagsField.setLineWrap(true); tagsField.setWrapStyleWord(true); frame.getContentPane().add(tagsField); tagsField.setColumns(10); lblTags = new JLabel("Tags:"); lblTags.setBounds(46, 451, 61, 16); frame.getContentPane().add(lblTags); descriptionField = new JTextArea(); descriptionField.setLineWrap(true); descriptionField.setWrapStyleWord(true); descriptionField.setBounds(137, 479, 187, 89); frame.getContentPane().add(descriptionField); descriptionField.setColumns(10); lblDescription = new JLabel("Description:"); lblDescription.setBounds(163, 451, 77, 16); frame.getContentPane().add(lblDescription); stepThree = new JLabel(""); stepThree.setToolTipText("here comes something different"); stepThree.setIcon(new ImageIcon("img/stepThree.png")); stepThree.setBounds(266, 685, 67, 49); frame.getContentPane().add(stepThree); JLabel lblImageType = new JLabel("Image type"); lblImageType.setBounds(23, 580, 102, 16); frame.getContentPane().add(lblImageType); String[] imageTypes = { "unspecified", "AnimategGif", "Clipart", "Line", "Photo" }; JComboBox imageTypeBox = new JComboBox(imageTypes); imageTypeBox.setBounds(137, 580, 187, 23); frame.getContentPane().add(imageTypeBox); JLabel lblSizeType = new JLabel("Size"); lblSizeType.setBounds(23, 608, 102, 16); frame.getContentPane().add(lblSizeType); String[] sizeTypes = { "unspecified", "Small", "Medium", "Large", "Wallpaper" }; JComboBox sizeBox = new JComboBox(sizeTypes); sizeBox.setBounds(137, 608, 187, 23); frame.getContentPane().add(sizeBox); JLabel lblLicenseType = new JLabel("License"); lblLicenseType.setBounds(23, 636, 102, 16); frame.getContentPane().add(lblLicenseType); String[] licenseTypes = { "unspecified", "Public", "Share", "ShareCommercially", "Modify" }; JComboBox licenseBox = new JComboBox(licenseTypes); licenseBox.setBounds(137, 636, 187, 23); frame.getContentPane().add(licenseBox); JLabel lblSafeSearchType = new JLabel("Safe search"); lblSafeSearchType.setBounds(23, 664, 102, 16); frame.getContentPane().add(lblSafeSearchType); String[] safeSearchTypes = { "Strict", "Moderate", "Off" }; JComboBox safeSearchBox = new JComboBox(safeSearchTypes); safeSearchBox.setBounds(137, 664, 187, 23); frame.getContentPane().add(safeSearchBox); btnSearchForSimilar = new JButton("Search for similar images"); btnSearchForSimilar.setVisible(true); btnSearchForSimilar.setBounds(66, 695, 189, 29); frame.getContentPane().add(btnSearchForSimilar); // label to try urls to display images, not shown on the main frame labelTryLinks = new JLabel(); labelTryLinks.setBounds(0, 0, 100, 100); foundImagesLabel1 = new JLabel(); foundImagesLabel1.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel1.setBounds(400, 49, 250, 250); frame.getContentPane().add(foundImagesLabel1); foundImagesLabel2 = new JLabel(); foundImagesLabel2.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel2.setBounds(400, 313, 250, 250); frame.getContentPane().add(foundImagesLabel2); foundImagesLabel3 = new JLabel(); foundImagesLabel3.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel3.setBounds(673, 49, 250, 250); frame.getContentPane().add(foundImagesLabel3); foundImagesLabel4 = new JLabel(); foundImagesLabel4.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel4.setBounds(673, 313, 250, 250); frame.getContentPane().add(foundImagesLabel4); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setStringPainted(true); progressBar.setBounds(440, 602, 440, 29); Border border = BorderFactory .createTitledBorder("We are checking every image, pixel by pixel, it may take a while..."); progressBar.setBorder(border); frame.getContentPane().add(progressBar); progressBar.setVisible(false); btnHelp = new JButton(""); btnHelp.setBorderPainted(false); ImageIcon btnIcon = new ImageIcon("img/helpRed.png"); btnHelp.setIcon(btnIcon); btnHelp.setBounds(917, 4, 77, 59); frame.getContentPane().add(btnHelp); // all action listeners btnBrowse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (fc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) { openFilechooser(); } } }); btnTurnWebcamOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setAllFoundImagesLabelsAndPreviewsToNull(); btnTakePictureWithWebcam.setVisible(true); btnCancel.setVisible(true); turnCameraOn(); } }); btnTakePictureWithWebcam.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnSaveImage.setVisible(true); // take a photo with web camera imageWebcam = webcam.getImage(); originalImage = imageWebcam; // to mirror the image we create a temporary file, flip it // horizontally and then delete // get user's name to store file in the user directory String user = System.getProperty("user.home"); String fileName = user + "/webCamPhoto.jpg"; File newFile = new File(fileName); try { ImageIO.write(originalImage, "jpg", newFile); } catch (IOException e1) { e1.printStackTrace(); } try { originalImage = (BufferedImage) ImageIO.read(newFile); } catch (IOException e1) { e1.printStackTrace(); } newFile.delete(); originalImage = mirrorImage(originalImage); icon = scaleBufferedImage(originalImage, originalImageLabel); originalImageLabel.setIcon(icon); } }); btnSaveImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { try { file = fc.getSelectedFile(); File output = new File(file.toString()); // check if image already exists if (output.exists()) { int response = JOptionPane.showConfirmDialog(null, // "Do you want to replace the existing file?", // "Confirm", JOptionPane.YES_NO_OPTION, // JOptionPane.QUESTION_MESSAGE); if (response != JOptionPane.YES_OPTION) { return; } } ImageIO.write(toBufferedImage(originalImage), "jpg", output); System.out.println("Your image has been saved in the folder " + file.getPath()); } catch (IOException e1) { e1.printStackTrace(); } } } }); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnTakePictureWithWebcam.setVisible(false); btnCancel.setVisible(false); btnSaveImage.setVisible(false); webcam.close(); panel.setVisible(false); } }); urlField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (urlField.getText().length() > 0) { String linkNew = urlField.getText(); getImageFromHttp(linkNew, originalImageLabel); originalImage = imageResponses; } } }); btnAnalyse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Token computerVisionToken = new Token(); String computerVisionTokenFileName = "APIToken.txt"; try { computerVisionImageToken = computerVisionToken.getApiToken(computerVisionTokenFileName); try { analyse(); } catch (NullPointerException e1) { // if user clicks on "analyze" button without uploading // image or posts a broken link JOptionPane.showMessageDialog(null, "Please choose an image"); e1.printStackTrace(); } } catch (NullPointerException e1) { e1.printStackTrace(); } } }); btnSearchForSimilar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // clear labels in case there were results of previous search setAllFoundImagesLabelsAndPreviewsToNull(); System.out.println("=========================================="); System.out.println("new search"); System.out.println("=========================================="); Token bingImageToken = new Token(); String bingImageTokenFileName = "SearchApiToken.txt"; bingToken = bingImageToken.getApiToken(bingImageTokenFileName); // in case user edited description or tags, update it and // replace new line character, spaces and breaks with %20 text = descriptionField.getText().replace(" ", "%20").replace("\r", "%20").replace("\n", "%20"); String tagsString = tagsField.getText().replace(" ", "%20").replace("\r", "%20").replace("\n", "%20"); imageTypeString = imageTypeBox.getSelectedItem().toString(); sizeTypeString = sizeBox.getSelectedItem().toString(); licenseTypeString = licenseBox.getSelectedItem().toString(); safeSearchTypeString = safeSearchBox.getSelectedItem().toString(); searchParameters = tagsString + text; System.out.println("search parameters: " + searchParameters); if (searchParameters.length() != 0) { // add new thread for searching, so that progress bar and // searching could run simultaneously Thread t1 = new Thread(new Runnable() { @Override public void run() { progressBar.setVisible(true); searchForSimilarImages(searchParameters, imageTypeString, sizeTypeString, licenseTypeString, safeSearchTypeString); } }); // start searching for similar images in a separate thread t1.start(); } else { JOptionPane.showMessageDialog(null, "Please choose first an image to analyse or insert search parameters"); } } }); foundImagesLabel1.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel1.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(firstImageUrl); } } } }); foundImagesLabel2.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel2.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(secondImageUrl); } } } }); foundImagesLabel3.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel3.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(thirdImageUrl); } } } }); foundImagesLabel4.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel4.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(fourthImageUrl); } } } }); btnHelp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO write help HelpFrame help = new HelpFrame(); } }); }
From source file:md.mclama.com.ModManager.java
/** * Create the frame./*from www .java 2s . co m*/ */ @SuppressWarnings("serial") public ModManager() throws MalformedURLException { setResizable(false); setTitle("McLauncher " + McVersion); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 700, 400); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(0, 0, 694, 372); contentPane.add(tabbedPane); profileListMdl = new DefaultListModel<String>(); ModListModel = new DefaultListModel<String>(); listModel = new DefaultListModel<String>(); getCurrentMods(); panelLauncher = new JPanel(); tabbedPane.addTab("Launcher", null, panelLauncher, null); panelLauncher.setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(556, 36, 132, 248); panelLauncher.add(scrollPane); profileList = new JList<String>(profileListMdl); profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(profileList); btnNewProfile = new JButton("New"); btnNewProfile.setFont(new Font("SansSerif", Font.PLAIN, 12)); btnNewProfile.setBounds(479, 4, 76, 20); panelLauncher.add(btnNewProfile); btnNewProfile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { newProfile(txtProfile.getText()); } }); btnNewProfile.setToolTipText("Click to create a new profile."); JButton btnRenameProfile = new JButton("Rename"); btnRenameProfile.setBounds(479, 25, 76, 20); panelLauncher.add(btnRenameProfile); btnRenameProfile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { renameProfile(); } }); btnRenameProfile.setToolTipText("Click to rename the selected profile"); JButton btnDelProfile = new JButton("Delete"); btnDelProfile.setBounds(479, 50, 76, 20); panelLauncher.add(btnDelProfile); btnDelProfile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteProfile(); } }); btnDelProfile.setToolTipText("Click to delete the selected profile."); JButton btnLaunch = new JButton("Launch"); btnLaunch.setBounds(605, 319, 89, 23); panelLauncher.add(btnLaunch); btnLaunch.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (selProfile != null) { LaunchFactorioWithSelectedMods(false); //dont ignore } } }); btnLaunch.setToolTipText("Click to launch factorio with the selected mod profile."); lblAvailableMods = new JLabel("Available Mods"); lblAvailableMods.setBounds(4, 155, 144, 14); panelLauncher.add(lblAvailableMods); lblAvailableMods.setFont(new Font("SansSerif", Font.PLAIN, 10)); lblAvailableMods.setText("Available Mods: " + -1); txtGamePath = new JTextField(); txtGamePath.setBounds(4, 5, 211, 23); panelLauncher.add(txtGamePath); txtGamePath.setToolTipText("Select tha path to your game!"); txtGamePath.setFont(new Font("Tahoma", Font.PLAIN, 8)); txtGamePath.setText("Game Path"); txtGamePath.setColumns(10); JButton btnFind = new JButton("find"); btnFind.setBounds(227, 3, 32, 23); panelLauncher.add(btnFind); txtProfile = new JTextField(); txtProfile.setBounds(556, 2, 132, 22); panelLauncher.add(txtProfile); txtProfile.setToolTipText("The name of NEW or RENAME profiles"); txtProfile.setText("Profile1"); txtProfile.setColumns(10); lblModsEnabled = new JLabel("Mods Enabled: -1"); lblModsEnabled.setBounds(335, 155, 95, 16); panelLauncher.add(lblModsEnabled); lblModsEnabled.setFont(new Font("SansSerif", Font.PLAIN, 10)); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(0, 167, 211, 165); panelLauncher.add(scrollPane_1); modsList = new JList<String>(listModel); modsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); modsList.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { String modName = util.getModVersion(modsList.getSelectedValue()); lblModVersion.setText("Mod Version: " + modName); checkDependency(modsList); if (modName.contains(".zip")) { new File(System.getProperty("java.io.tmpdir") + modName.replace(".zip", "")).delete(); } if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click addMod(); } lastClickTime = System.currentTimeMillis(); } }); scrollPane_1.setViewportView(modsList); modsList.setFont(new Font("Tahoma", Font.PLAIN, 9)); JScrollPane scrollPane_2 = new JScrollPane(); scrollPane_2.setBounds(333, 167, 211, 165); panelLauncher.add(scrollPane_2); enabledModsList = new JList<String>(ModListModel); enabledModsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); enabledModsList.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { lblModVersion.setText("Mod Version: " + util.getModVersion(enabledModsList.getSelectedValue())); checkDependency(enabledModsList); if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click removeMod(); } lastClickTime = System.currentTimeMillis(); } }); enabledModsList.setFont(new Font("SansSerif", Font.PLAIN, 10)); scrollPane_2.setViewportView(enabledModsList); JButton btnEnable = new JButton("Enable"); btnEnable.setBounds(223, 200, 90, 28); panelLauncher.add(btnEnable); btnEnable.setToolTipText("Add mod -->"); JButton btnDisable = new JButton("Disable"); btnDisable.setBounds(223, 240, 90, 28); panelLauncher.add(btnDisable); btnDisable.setToolTipText("Disable mod "); JLabel lblModsAvailable = new JLabel("Mods available"); lblModsAvailable.setBounds(4, 329, 89, 14); panelLauncher.add(lblModsAvailable); lblModsAvailable.setFont(new Font("SansSerif", Font.PLAIN, 10)); JLabel lblEnabledMods = new JLabel("Enabled Mods"); lblEnabledMods.setBounds(337, 329, 89, 16); panelLauncher.add(lblEnabledMods); lblEnabledMods.setFont(new Font("SansSerif", Font.PLAIN, 10)); lblModVersion = new JLabel("Mod Version: (select a mod first)"); lblModVersion.setBounds(4, 117, 183, 14); panelLauncher.add(lblModVersion); lblModVersion.setFont(new Font("SansSerif", Font.PLAIN, 10)); lblRequiredMods = new JLabel("Required Mods: " + reqModsStr); lblRequiredMods.setBounds(6, 143, 538, 14); panelLauncher.add(lblRequiredMods); lblRequiredMods.setHorizontalAlignment(SwingConstants.RIGHT); lblRequiredMods.setFont(new Font("SansSerif", Font.PLAIN, 10)); JButton btnNewButton = new JButton("TEST"); btnNewButton.setVisible(testBtnEnabled); btnNewButton.setEnabled(testBtnEnabled); btnNewButton.setBounds(338, 61, 90, 28); panelLauncher.add(btnNewButton); btnUpdate.setBounds(218, 322, 103, 20); panelLauncher.add(btnUpdate); btnUpdate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { util.updateLauncher(); } }); btnUpdate.setVisible(false); btnUpdate.setFont(new Font("SansSerif", Font.PLAIN, 9)); lblModRequires = new JLabel("Mod Requires: (Select a mod first)"); lblModRequires.setBounds(4, 127, 317, 16); panelLauncher.add(lblModRequires); btnLaunchIgnore = new JButton("Launch + ignore"); btnLaunchIgnore.setToolTipText("Ignore any errors that McLauncher may not correctly account for."); btnLaunchIgnore.setFont(new Font("SansSerif", Font.PLAIN, 11)); btnLaunchIgnore.setBounds(556, 284, 133, 23); panelLauncher.add(btnLaunchIgnore); JButton btnConsole = new JButton("Console"); btnConsole.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean changeto = !con.isVisible(); con.setVisible(changeto); con.updateConsole(); } }); btnConsole.setBounds(335, 0, 90, 28); panelLauncher.add(btnConsole); JPanel panelDownloadMods = new JPanel(); tabbedPane.addTab("Download Mods", null, panelDownloadMods, null); panelDownloadMods.setLayout(null); scrollPane_3 = new JScrollPane(); scrollPane_3.setBounds(0, 0, 397, 303); panelDownloadMods.add(scrollPane_3); dlModel = new DefaultTableModel(new Object[][] {}, new String[] { "Mod Name", "Author", "Version", "Tags" }) { Class[] columnTypes = new Class[] { String.class, String.class, String.class, Object.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } boolean[] columnEditables = new boolean[] { false, false, false, false }; public boolean isCellEditable(int row, int column) { return columnEditables[column]; }; }; tSorter = new TableRowSorter<DefaultTableModel>(dlModel); tableDownloads = new JTable(); tableDownloads.setRowSorter(tSorter); tableDownloads.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { trow = tableDownloads.getSelectedRow(); trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow); getDlModData(); canDownloadMod = true; } }); tableDownloads.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { trow = tableDownloads.getSelectedRow(); trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow); getDlModData(); canDownloadMod = true; } }); tableDownloads.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); tableDownloads.setShowVerticalLines(true); tableDownloads.setShowHorizontalLines(true); tableDownloads.setModel(dlModel); tableDownloads.getColumnModel().getColumn(0).setPreferredWidth(218); tableDownloads.getColumnModel().getColumn(1).setPreferredWidth(97); tableDownloads.getColumnModel().getColumn(2).setPreferredWidth(77); scrollPane_3.setViewportView(tableDownloads); btnDownload = new JButton("Download"); btnDownload.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (canDownloadMod && !CurrentlyDownloading) { String dlUrl = getModDownloadUrl(); try { if (dlUrl.equals("") || dlUrl.equals(" ") || dlUrl == null) { con.log("Log", "No download link for mod, got... '" + dlUrl + "'"); } else { CurrentlyDownloading = true; CurrentDownload = new Download(new URL(dlUrl), McLauncher); } } catch (MalformedURLException e1) { con.log("Log", "Failed to download mod... No download URL?"); } } } }); btnDownload.setBounds(307, 308, 90, 28); panelDownloadMods.add(btnDownload); btnGotoMod = new JButton("Mod Page"); btnGotoMod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { util.openWebpage(modPageUrl); } }); btnGotoMod.setEnabled(false); btnGotoMod.setBounds(134, 308, 90, 28); panelDownloadMods.add(btnGotoMod); pBarDownloadMod = new JProgressBar(); pBarDownloadMod.setBounds(538, 308, 150, 10); panelDownloadMods.add(pBarDownloadMod); pBarExtractMod = new JProgressBar(); pBarExtractMod.setBounds(538, 314, 150, 10); panelDownloadMods.add(pBarExtractMod); lblDownloadModInfo = new JLabel("Download progress"); lblDownloadModInfo.setBounds(489, 326, 199, 16); panelDownloadMods.add(lblDownloadModInfo); lblDownloadModInfo.setHorizontalAlignment(SwingConstants.TRAILING); panelModImg = new JPanel(); panelModImg.setBounds(566, 0, 128, 128); panelDownloadMods.add(panelModImg); txtFilterText = new JTextField(); txtFilterText.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { if (txtFilterText.getText().equals("Filter Text")) { txtFilterText.setText(""); newFilter(); } } }); txtFilterText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (!txtFilterText.getText().equals("Filter Text")) { newFilter(); } } }); txtFilterText.setText("Filter Text"); txtFilterText.setBounds(0, 308, 122, 28); panelDownloadMods.add(txtFilterText); txtFilterText.setColumns(10); comboBox = new JComboBox(); comboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { newFilter(); } }); comboBox.setModel(new DefaultComboBoxModel(new String[] { "No tag filter", "Vanilla", "Machine", "Mechanic", "New Ore", "Module", "Big Mod", "Power", "GUI", "Map-Gen", "Must-Have", "Equipment" })); comboBox.setBounds(403, 44, 150, 26); panelDownloadMods.add(comboBox); lblModDlCounter = new JLabel("Mod database: "); lblModDlCounter.setFont(new Font("SansSerif", Font.PLAIN, 10)); lblModDlCounter.setBounds(403, 5, 162, 16); panelDownloadMods.add(lblModDlCounter); txtrDMModDescription = new JTextArea(); txtrDMModDescription.setBackground(Color.LIGHT_GRAY); txtrDMModDescription.setBorder(new LineBorder(new Color(0, 0, 0))); txtrDMModDescription.setFocusable(false); txtrDMModDescription.setEditable(false); txtrDMModDescription.setLineWrap(true); txtrDMModDescription.setWrapStyleWord(true); txtrDMModDescription.setText("Mod Description: "); txtrDMModDescription.setBounds(403, 132, 285, 75); panelDownloadMods.add(txtrDMModDescription); lblDMModTags = new JTextArea(); lblDMModTags.setFocusable(false); lblDMModTags.setEditable(false); lblDMModTags.setBorder(new LineBorder(new Color(0, 0, 0))); lblDMModTags.setWrapStyleWord(true); lblDMModTags.setLineWrap(true); lblDMModTags.setBackground(Color.LIGHT_GRAY); lblDMModTags.setText("Mod Tags: "); lblDMModTags.setBounds(403, 71, 160, 60); panelDownloadMods.add(lblDMModTags); lblDMRequiredMods = new JTextArea(); lblDMRequiredMods.setFocusable(false); lblDMRequiredMods.setEditable(false); lblDMRequiredMods.setText("Required Mods: "); lblDMRequiredMods.setWrapStyleWord(true); lblDMRequiredMods.setLineWrap(true); lblDMRequiredMods.setBorder(new LineBorder(new Color(0, 0, 0))); lblDMRequiredMods.setBackground(Color.LIGHT_GRAY); lblDMRequiredMods.setBounds(403, 208, 285, 57); panelDownloadMods.add(lblDMRequiredMods); lblDLModLicense = new JLabel(""); lblDLModLicense.setHorizontalAlignment(SwingConstants.RIGHT); lblDLModLicense.setBounds(403, 294, 285, 16); panelDownloadMods.add(lblDLModLicense); lblWipmod = new JLabel(""); lblWipmod.setBounds(395, 314, 64, 16); panelDownloadMods.add(lblWipmod); JButton btnCancel = new JButton("Cancel"); btnCancel.setToolTipText("Stop downloading"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CurrentDownload.cancel(); } }); btnCancel.setBounds(230, 308, 72, 28); panelDownloadMods.add(btnCancel); panelOptions = new JPanel(); tabbedPane.addTab("Options", null, panelOptions, null); panelOptions.setLayout(null); scrollPane_4.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane_4.setBounds(0, 0, 694, 342); panelOptions.add(scrollPane_4); panel = new JPanel(); scrollPane_4.setViewportView(panel); panel.setLayout(null); lblCloseMclauncherAfter = new JLabel("Close McLauncher after launching Factorio?"); lblCloseMclauncherAfter.setBounds(6, 6, 274, 16); panel.add(lblCloseMclauncherAfter); lblCloseMclauncherAfter_1 = new JLabel("Close McLauncher after updating?"); lblCloseMclauncherAfter_1.setBounds(6, 34, 274, 16); panel.add(lblCloseMclauncherAfter_1); lblSortNewestDownloadable = new JLabel("Sort newest downloadable mods first?"); lblSortNewestDownloadable.setBounds(6, 62, 274, 16); panel.add(lblSortNewestDownloadable); tglbtnNewModsFirst = new JToggleButton("Toggle"); tglbtnNewModsFirst.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { lblNeedrestart.setText("McLauncher needs to restart for that to work"); writeData(); } }); tglbtnNewModsFirst.setSelected(true); tglbtnNewModsFirst.setBounds(281, 56, 66, 28); panel.add(tglbtnNewModsFirst); tglbtnCloseAfterUpdate = new JToggleButton("Toggle"); tglbtnCloseAfterUpdate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { writeData(); } }); tglbtnCloseAfterUpdate.setBounds(281, 28, 66, 28); panel.add(tglbtnCloseAfterUpdate); tglbtnCloseAfterLaunch = new JToggleButton("Toggle"); tglbtnCloseAfterLaunch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { writeData(); } }); tglbtnCloseAfterLaunch.setBounds(281, 0, 66, 28); panel.add(tglbtnCloseAfterLaunch); tglbtnDisplayon = new JToggleButton("On"); tglbtnDisplayon.setFont(new Font("SansSerif", Font.PLAIN, 10)); tglbtnDisplayon.setSelected(true); tglbtnDisplayon.setBounds(588, 308, 44, 28); panel.add(tglbtnDisplayon); tglbtnDisplayoff = new JToggleButton("Off"); tglbtnDisplayoff.setFont(new Font("SansSerif", Font.PLAIN, 10)); tglbtnDisplayoff.setBounds(644, 308, 44, 28); panel.add(tglbtnDisplayoff); lblInfo = new JLabel("What enabled and disabled look like"); lblInfo.setFont(new Font("SansSerif", Font.PLAIN, 10)); lblInfo.setHorizontalAlignment(SwingConstants.TRAILING); lblInfo.setBounds(359, 314, 231, 16); panel.add(lblInfo); JSeparator separator = new JSeparator(); separator.setBounds(6, 55, 676, 24); panel.add(separator); JSeparator separator_1 = new JSeparator(); separator_1.setBounds(6, 27, 676, 18); panel.add(separator_1); JSeparator separator_2 = new JSeparator(); separator_2.setBounds(6, 84, 676, 24); panel.add(separator_2); JSeparator separator_3 = new JSeparator(); separator_3.setOrientation(SwingConstants.VERTICAL); separator_3.setBounds(346, 0, 16, 336); panel.add(separator_3); lblNeedrestart = new JLabel(""); lblNeedrestart.setBounds(6, 314, 341, 16); panel.add(lblNeedrestart); tglbtnSendAnonData = new JToggleButton("Toggle"); tglbtnSendAnonData.setToolTipText("Information regarding the activity of McLauncher."); tglbtnSendAnonData.setSelected(true); //set enabled by default. tglbtnSendAnonData.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { writeData(); } }); tglbtnSendAnonData.setBounds(622, 0, 66, 28); panel.add(tglbtnSendAnonData); lblSendAnonymousUse = new JLabel("Send anonymous use data?"); lblSendAnonymousUse.setBounds(359, 6, 251, 16); panel.add(lblSendAnonymousUse); lblDeleteOldMod = new JLabel("Delete old mod before updating?"); lblDeleteOldMod.setBounds(359, 34, 251, 16); panel.add(lblDeleteOldMod); tglbtnDeleteBeforeUpdate = new JToggleButton("Toggle"); tglbtnDeleteBeforeUpdate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { writeData(); } }); tglbtnDeleteBeforeUpdate.setBounds(622, 28, 66, 28); panel.add(tglbtnDeleteBeforeUpdate); tglbtnAlertOnModUpdateAvailable = new JToggleButton("Toggle"); tglbtnAlertOnModUpdateAvailable.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { writeData(); } }); tglbtnAlertOnModUpdateAvailable.setSelected(true); tglbtnAlertOnModUpdateAvailable.setBounds(281, 86, 66, 28); panel.add(tglbtnAlertOnModUpdateAvailable); separator_4 = new JSeparator(); separator_4.setBounds(0, 112, 676, 24); panel.add(separator_4); JLabel lblAlertModHas = new JLabel("Alert mod has update on launch?"); lblAlertModHas.setBounds(6, 92, 231, 16); panel.add(lblAlertModHas); panelChangelog = new JPanel(); tabbedPane.addTab("Changelog", null, panelChangelog, null); panelChangelog.setLayout(new BoxLayout(panelChangelog, BoxLayout.X_AXIS)); scrollPane_6 = new JScrollPane(); panelChangelog.add(scrollPane_6); textChangelog = new JTextArea(); scrollPane_6.setViewportView(textChangelog); textChangelog.setEditable(false); textChangelog.setText( "v0.4.6\r\n\r\n+Fix problem where config file would not save in the correct location. (Thanks Arano-kai)\r\n+McLauncher will now save when you select a path, or profile. (Thanks Arano-kai)\r\n+Fixed an issue where McLauncher could not get the version from a .zip mod. (Thanks Arano-kai)\r\n+Added a Cancel button to stop downloading the current mod. (Suggested by Arano-kai)\r\n\r\n\r\n\r\nv0.4.5\r\n\r\n+McLauncher should now correctly warn you on failed write/read access.\r\n+McLauncher should now work when a user has both zip and installer versions of factorio. (Thanks Jeroon)\r\n+Attempt to fix an error with dependency and .zip files, With versions. (Thanks Arano-kai)\r\n+Fix only allow single selection of mods. (Thanks Arano-kai)\r\n+Fix for the Launch+Ignore button problem on linux being cut off. (Thanks Arano-kai)\r\n+Display download progress.\r\n+Fixed an error that was thrown when clicking on some mods that had a single dependency mod.\r\n+Double clicking on a mod will now enable or disable the mod. (Thanks Arano-kai)"); btnLaunchIgnore.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (selProfile != null) { LaunchFactorioWithSelectedMods(true); //ignore errors, launch. } } }); btnLaunchIgnore.setVisible(false); //This is my test button. I use this to test things then implement them into the swing. btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testButtonCode(e); } }); //Disable mods button. (from profile) btnDisable.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeMod(); } }); //Enable mods button. (to profile) btnEnable.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addMod(); } }); //Game path button btnFind.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { findPath(); } }); //mouseClick event lister for when you click on a new profile profileList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { selectedProfile(); } }); readData(); //Load settings init(); //some extra init getMods(); //Get the mods the user has installed }
From source file:org.jets3t.apps.uploader.Uploader.java
/** * Configures a button's text, tooltip and image using uploader properties prefixed * with the given properties prefix./* www . j a v a2 s .c o m*/ * * @param button * @param propertiesPrefix */ private void configureButton(JButton button, String propertiesPrefix) { button.setHorizontalAlignment(JLabel.CENTER); String buttonImagePath = uploaderProperties.getStringProperty(propertiesPrefix + ".image", null); String buttonText = replaceMessageVariables( uploaderProperties.getStringProperty(propertiesPrefix + ".text", null)); String buttonTooltip = replaceMessageVariables( uploaderProperties.getStringProperty(propertiesPrefix + ".tooltip", null)); boolean hasImage = false; boolean hasText = false; if (buttonImagePath != null && buttonImagePath.length() > 0) { if (!guiUtils.applyIcon(button, buttonImagePath)) { log.error("Unable to load image URL for a button with property prefix '" + propertiesPrefix + "'. Image path: " + buttonImagePath); } else { hasImage = true; } } if (buttonText != null && buttonText.length() > 0) { String text = replaceMessageVariables(buttonText); button.setText(text); button.setMnemonic(text.charAt(0)); hasText = true; } if (buttonTooltip != null && buttonTooltip.length() > 0) { button.setToolTipText(buttonTooltip); } if (!hasImage && !hasText) { button.setVisible(false); } else { button.setVisible(true); } }
From source file:au.org.ala.delta.intkey.Intkey.java
private void updateDynamicButtons() { for (JButton b : _advancedModeOnlyDynamicButtons) { b.setVisible(_advancedMode); }// w ww.j a v a 2 s . c om for (JButton b : _normalModeOnlyDynamicButtons) { b.setVisible(!_advancedMode); } for (JButton b : _activeOnlyWhenCharactersUsedButtons) { if (_usedCharacterListModel != null) { b.setEnabled(_usedCharacterListModel.size() > 0); } else { b.setEnabled(false); } } _rootPanel.revalidate(); }
From source file:Form.Principal.java
public void PanelFacturas() { int i = 0;//w w w . j a v a 2 s. c o m int Altura = 0; Color gris = new Color(44, 44, 44); Color azul = new Color(0, 153, 255); Color rojo = new Color(221, 76, 76); try { //Consultamos todos los clientes ResultSet Comandos = Funcion.Select(st, "SELECT factura_emitida.*, cliente.* FROM cliente,factura_emitida WHERE factura_emitida.idCliente = cliente.idCliente;"); //Ciclo para crear un panel para cada uno while (Comandos.next()) { Variables.Comentario = Comandos.getString("Observaciones"); //Creamos un panel con alineacion a la izquierda JPanel Panel = new JPanel(); Panel.setLayout(null); jPanel11.add(Panel); //Tamao del panel Panel.setSize(680, 200); // La posicion y del panel ira incrementando para que no se encimen Altura = 30 + (i * 250); Panel.setLocation(50, Altura); Panel.setBackground(Color.white); Panel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); //Creamos label para mostrar los datos del cliente, el codigo html es para que al llegar al final del panel //se pase a la siguiente linea y para el margen izquierdo JLabel FolioFactura = new JLabel(); FolioFactura.setText("Folio de factura: " + Comandos.getString("idFacturaEmitida")); JLabel RFC = new JLabel(); RFC.setText("RFC: " + Comandos.getString("RFC")); JLabel Nombre = new JLabel(); Nombre.setText("Nombre: " + Comandos.getString("NombreCliente")); JLabel Direccion = new JLabel(); Direccion.setText("Direccion: " + Comandos.getString("Direccion")); JLabel Correo = new JLabel(); Correo.setText("Correo: " + Comandos.getString("correo")); JLabel Fecha = new JLabel(); Fecha.setText("Fecha y Hora de emisin: " + Comandos.getString("FechaEmision")); JButton Abre = new JButton(); Abre.setText("Abrir"); Abre.setName(Comandos.getString("idFacturaEmitida")); Abre.setBackground(azul); JButton Cancelar = new JButton(); Cancelar.setText("Cancelar"); Cancelar.setName(Comandos.getString("idFacturaEmitida")); Cancelar.setBackground(rojo); MouseListener mlAbre = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { //System.out.println("Released!"); } @Override public void mousePressed(MouseEvent e) { //System.out.println("Pressed!"); } @Override public void mouseExited(MouseEvent e) { //System.out.println("Exited!"); } @Override public void mouseEntered(MouseEvent e) { //System.out.println("Entered!"); } @Override public void mouseClicked(MouseEvent e) { try { JButton source = (JButton) e.getSource(); idFacClien = Integer.parseInt(source.getName()); ResultSet Comandos = Funcion.Select(st, "SELECT *FROM factura_emitida WHERE idfacturaEmitida=" + idFacClien + ";"); while (Comandos.next()) { Variables.FechaFactura = Comandos.getString("FechaEmision"); Variables.FechaSistema = Comandos.getString("fechasistema"); Variables.idFactura = Comandos.getInt("idFacturaEmitida"); } Consulta(); Variables.guardar = false; NuevoPdf pdf = new NuevoPdf("Factura.pdf"); pdf.main(); File myfile = new File("Factura.pdf"); Desktop.getDesktop().open(myfile); Comandos = Funcion.Select(st, "SELECT * FROM factura_emitida;"); try { if (Comandos.next()) { Comandos.last(); Variables.idFactura = Comandos.getInt("idFacturaEmitida") + 1; } else { Variables.idFactura = 1; } } catch (SQLException ex) { Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } } catch (Exception ex) { Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } } }; MouseListener mlCancelar = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { //System.out.println("Released!"); } @Override public void mousePressed(MouseEvent e) { //System.out.println("Pressed!"); } @Override public void mouseExited(MouseEvent e) { //System.out.println("Exited!"); } @Override public void mouseEntered(MouseEvent e) { //System.out.println("Entered!"); } @Override public void mouseClicked(MouseEvent e) { JButton source = (JButton) e.getSource(); Variables.Cancelar = Integer.parseInt(source.getName()); String Comando = "UPDATE factura_emitida SET Observaciones='Factura Cancelada' WHERE idFacturaEmitida=" + Variables.Cancelar + ";"; Funcion.Update(st, Comando); jPanel11.removeAll(); PanelFacturas(); jPanel11.repaint(); } }; Abre.addMouseListener(mlAbre); Cancelar.addMouseListener(mlCancelar); //Fuente del texto; FolioFactura.setFont(new Font("Verdana", Font.PLAIN, 13)); FolioFactura.setForeground(gris); RFC.setFont(new Font("Verdana", Font.PLAIN, 13)); RFC.setForeground(gris); Nombre.setFont(new Font("Verdana", Font.PLAIN, 13)); Nombre.setForeground(gris); Direccion.setFont(new Font("Verdana", Font.PLAIN, 13)); Direccion.setForeground(gris); Correo.setFont(new Font("Verdana", Font.PLAIN, 13)); Correo.setForeground(gris); Fecha.setFont(new Font("Verdana", Font.PLAIN, 13)); Fecha.setForeground(gris); /// Botones Abre.setFont(new Font("Verdana", Font.PLAIN, 15)); Abre.setForeground(Color.white); Cancelar.setFont(new Font("Verdana", Font.PLAIN, 15)); Cancelar.setForeground(Color.white); //Aadimos los label al panel correspondiente del cliente Panel.add(FolioFactura); Panel.add(RFC); Panel.add(Nombre); Panel.add(Direccion); Panel.add(Correo); Panel.add(Fecha); Panel.add(Abre); FolioFactura.setLocation(15, 5); FolioFactura.setSize(400, 45); RFC.setLocation(15, 25); RFC.setSize(400, 45); Nombre.setLocation(15, 45); Nombre.setSize(500, 45); Direccion.setLocation(15, 65); Direccion.setSize(650, 45); Correo.setLocation(15, 85); Correo.setSize(500, 45); Fecha.setLocation(15, 105); Fecha.setSize(500, 45); /// Botones Tamao y localizacion if (Variables.Tipo.equalsIgnoreCase("Administrador")) { // Verificamos que sea un Administrador Panel.add(Cancelar); Abre.setLocation(185, 160); Abre.setSize(120, 30); Cancelar.setLocation(350, 160); Cancelar.setSize(120, 30); if (Variables.Comentario.equalsIgnoreCase("Factura Cancelada")) { Cancelar.setVisible(false); Abre.setLocation(290, 160); Abre.setSize(120, 30); } } else { Abre.setLocation(290, 160); Abre.setSize(120, 30); } i++; } } catch (SQLException ex) { Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } //Dependiendo de cuantos clientes se agregaron, se ajusta el tamao del panel principal para que el scroll llegue hasta ahi jPanel11.setPreferredSize(new Dimension(jPanel11.getWidth(), Altura + 300)); }
From source file:org.ut.biolab.medsavant.client.project.ProjectWizard.java
private AbstractWizardPage getCreatePage() { //setup page/* ww w. ja v a 2 s . c o m*/ final DefaultWizardPage page = new DefaultWizardPage(PAGENAME_CREATE) { @Override public void setupWizardButtons() { fireButtonEvent(ButtonEvent.SHOW_BUTTON, ButtonNames.BACK); fireButtonEvent(ButtonEvent.HIDE_BUTTON, ButtonNames.FINISH); fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT); } }; page.addText("You are now ready to " + (modify ? "make changes to" : "create") + " this project. "); final JLabel progressLabel = new JLabel(""); page.addComponent(progressLabel); final JButton workButton = new JButton((modify ? "Modify Project" : "Create Project")); final JButton publishButton = new JButton("Publish Variants"); final JComponent j = new JLabel( "<html><p>You may continue. The import process will continue in the< background and you will be notified upon completion.</p></html>"); workButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { j.setVisible(true); page.fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT); workButton.setEnabled(false); new ProjectWorker<Void>("Modifying project", autoPublish.isSelected(), LoginController.getSessionID(), projectID) { @Override protected Void runInBackground() throws Exception { LOG.info("Requesting modification from server"); modifyProject(true, true, true, this); LOG.info("Modification complete"); return null; } }.execute(); toFront(); } }); page.addComponent(ViewUtil.alignRight(workButton)); page.addComponent(j); j.setVisible(false); if (modify) { page.addComponent(ViewUtil.alignRight(publishButton)); publishButton.setVisible(false); } return page; }