OpFooter(OpControl control, List<LayerMode> layerModes) { super(BoxLayout.X_AXIS); layerControls = new LayerControls(control, layerModes, pcs); invertRegionSwitch = new InvertRegionCheckBox(control, pcs); colorControls = new ColorSelectionControls(control, pcs); Box blendBox = Box.createVerticalBox(); blendBox.add(Box.createVerticalStrut(5)); blendBox.add(layerControls); blendBox.add(invertRegionSwitch); blendBox.setBackground(LightZoneSkin.Colors.ToolPanesBackground); layerControls.setAlignmentX(Component.LEFT_ALIGNMENT); invertRegionSwitch.setAlignmentX(Component.LEFT_ALIGNMENT); tabPane = new JTabbedPane(); tabPane.setFont(LightZoneSkin.fontSet.getSmallFont()); tabPane.add(LOCALE.get("ToolSettingsTabName"), blendBox); tabPane.add(LOCALE.get("ColorSelectionTabName"), colorControls); tabPane.setIconAt(0, getThemeIcon(orangeScheme, true)); tabPane.setIconAt(1, getThemeIcon(orangeScheme, false)); add(tabPane, BorderLayout.NORTH); setBackground(LightZoneSkin.Colors.ToolPanesBackground); pcs.addPropertyChangeListener(this); }
/** * populates the conflict resolver with the conflicts between my and their * * @param conflict the conflict data set */ public void populate(Conflict<? extends OsmPrimitive> conflict) { setMy(conflict.getMy()); setTheir(conflict.getTheir()); this.conflict = conflict; propertiesMerger.populate(conflict); tabbedPane.setEnabledAt(0, true); tagMerger.populate(conflict); tabbedPane.setEnabledAt(1, true); if (my instanceof Node) { tabbedPane.setEnabledAt(2, false); tabbedPane.setEnabledAt(3, false); } else if (my instanceof Way) { nodeListMerger.populate(conflict); tabbedPane.setEnabledAt(2, true); tabbedPane.setEnabledAt(3, false); tabbedPane.setTitleAt(3, tr("Members")); tabbedPane.setIconAt(3, null); } else if (my instanceof Relation) { relationMemberMerger.populate(conflict); tabbedPane.setEnabledAt(2, false); tabbedPane.setTitleAt(2, tr("Nodes")); tabbedPane.setIconAt(2, null); tabbedPane.setEnabledAt(3, true); } updateResolvedCompletely(); selectFirstTabWithConflicts(); }
public synchronized void toggleCurrentSQLResultTabSticky() { if (null != _stickyTab) { if (_stickyTab.equals(_tabbedExecutionsPanel.getSelectedComponent())) { // Sticky is turned off. Just remove sticky and return. _stickyTab = null; _tabbedExecutionsPanel.setIconAt(_tabbedExecutionsPanel.getSelectedIndex(), null); return; } else { // remove old sticky tab int indexOfStickyTab = getIndexOfTab(_stickyTab); if (-1 != indexOfStickyTab) { _tabbedExecutionsPanel.setIconAt(indexOfStickyTab, null); } _stickyTab = null; } } if (false == _tabbedExecutionsPanel.getSelectedComponent() instanceof IResultTab) { // i18n[SQLResultExecuterPanel.nonStickyPanel=Cannot make a cancel panel sticky] String msg = s_stringMgr.getString("SQLResultExecuterPanel.nonStickyPanel"); JOptionPane.showMessageDialog(_session.getApplication().getMainFrame(), msg); return; } _stickyTab = (IResultTab) _tabbedExecutionsPanel.getSelectedComponent(); int selectedIndex = _tabbedExecutionsPanel.getSelectedIndex(); ImageIcon icon = getStickyIcon(); _tabbedExecutionsPanel.setIconAt(selectedIndex, icon); }
public void propertyChange(PropertyChangeEvent evt) { if (tabPane != null && evt.getPropertyName().equals(ColorSelectionControls.COLOR_SELECTION)) { if (evt.getNewValue() == Boolean.TRUE) tabPane.setIconAt(1, getThemeIcon(null, false)); else tabPane.setIconAt(1, getThemeIcon(orangeScheme, false)); } if (layerControls != null && evt.getPropertyName().equals(LayerControls.BLENDING_MODES)) { if (evt.getNewValue() == Boolean.TRUE) tabPane.setIconAt(0, getThemeIcon(null, true)); else tabPane.setIconAt(0, getThemeIcon(orangeScheme, true)); } }
public void setNewsIcon() { int i = getUnreadNews(); if (i > 0 && i < 100) { tabbedPane.setIconAt( 0, new ImageAndTextIcon( this.getClass() .getResource("/image/tabs/news_unread_" + Integer.toString(i).length() + ".png"), Integer.toString(i))); } else { tabbedPane.setIconAt(0, new ImageIcon(this.getClass().getResource("/image/tabs/news.png"))); } }
@Override public void setIconAt(int index, Icon icon) { super.setIconAt(index, icon); final Component comp = getTabComponentAt(index); if (comp instanceof TabComponent) ((TabComponent) comp).setIcon(icon); }
/** * Update the icon on tab page of which session be modified with newer state. * * @param state newer state of session * @param session target session to be modified the icon */ public void updateTabState(final int state, final SessionPane session) { int index; ImageIcon imageIcon; switch (state) { case SessionPane.STATE_TRYING: imageIcon = tryingIcon; break; case SessionPane.STATE_CONNECTED: imageIcon = connectedIcon; break; case SessionPane.STATE_CLOSED: imageIcon = closedIcon; break; case SessionPane.STATE_ALERT: imageIcon = bellIcon; break; default: imageIcon = null; } index = tabbedPane.indexOfComponent(session); if (index != -1) { tabbedPane.setIconAt(index, imageIcon); } }
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(TagConflictResolverModel.NUM_CONFLICTS_PROP)) { TagConflictResolverModel model = (TagConflictResolverModel) evt.getSource(); for (int i = 0; i < tpResolvers.getTabCount(); i++) { TagConflictResolver resolver = (TagConflictResolver) tpResolvers.getComponentAt(i); if (model == resolver.getModel()) { tpResolvers.setIconAt(i, (Boolean) evt.getNewValue() ? iconResolved : iconUnresolved); } } } }
/** Sets the tab icons for each power. */ private void setTabIcons() { if (mmd != null) { final World world = clientFrame.getWorld(); final int tabCount = tabPane.getTabCount(); for (int i = 1; i < tabCount; i++) // no icon for 'game' info { Power power = world.getMap().getPower(tabPane.getTitleAt(i)); assert (power != null); String colorName = mmd.getPowerColor(power); Color color = SVGColorParser.parseColor(colorName); tabPane.setIconAt(i, new ColorRectIcon(12, 12, color)); } } } // setTabIcons()
public void setIconAt(int index, String iconFile) { try { File file = new File(iconFile); if (file.exists() == false) { String filename = FindIconHelper.findImage(iconFile); file = new File(filename); } JLabel label = (JLabel) getTabComponentAt(index); if (label != null) { label.setIcon(new ImageIcon(ImageIO.read(file))); } } catch (IOException e) { super.setIconAt(index, null); } }
/** call this to login */ private void doLogin(final String username, String password) { if (password.isEmpty()) { PasswordDialog p = new PasswordDialog(this, true); p.setVisible(true); if (tempPass.isEmpty()) { enableObjects(); return; } password = tempPass; } Logger.logInfo("Logging in..."); tabbedPane.setEnabledAt(0, false); tabbedPane.setIconAt(0, new ImageIcon(this.getClass().getResource("/image/tabs/news.png"))); tabbedPane.setEnabledAt(1, false); tabbedPane.setEnabledAt(2, false); tabbedPane.setEnabledAt(3, false); tabbedPane.setEnabledAt(4, false); tabbedPane.getSelectedComponent().setEnabled(false); launch.setEnabled(false); users.setEnabled(false); edit.setEnabled(false); serverbutton.setEnabled(false); mapInstall.setEnabled(false); mapInstallLocation.setEnabled(false); serverMap.setEnabled(false); tpInstall.setEnabled(false); tpInstallLocation.setEnabled(false); LoginWorker loginWorker = new LoginWorker(username, password) { @Override public void done() { String responseStr; try { responseStr = get(); } catch (InterruptedException err) { Logger.logError(err.getMessage(), err); enableObjects(); return; } catch (ExecutionException err) { if (err.getCause() instanceof IOException || err.getCause() instanceof MalformedURLException) { Logger.logError(err.getMessage(), err); PlayOfflineDialog d = new PlayOfflineDialog("mcDown", username); d.setVisible(true); } enableObjects(); return; } try { RESPONSE = new LoginResponse(responseStr); } catch (IllegalArgumentException e) { if (responseStr.contains(":")) { Logger.logError("Received invalid response from server."); } else { if (responseStr.equalsIgnoreCase("bad login")) { ErrorUtils.tossError("Invalid username or password."); } else if (responseStr.equalsIgnoreCase("old version")) { ErrorUtils.tossError("Outdated launcher."); } else { ErrorUtils.tossError("Login failed: " + responseStr); PlayOfflineDialog d = new PlayOfflineDialog("mcDown", username); d.setVisible(true); } } enableObjects(); return; } Logger.logInfo("Login complete."); runGameUpdater(RESPONSE); } }; loginWorker.execute(); }
/** Create the frame. */ public LaunchFrame(final int tab) { setFont(new Font("a_FuturaOrto", Font.PLAIN, 12)); setResizable(false); setTitle("Feed the Beast Launcher v" + version); setIconImage( Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/image/logo_ftb.png"))); panel = new JPanel(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); if (OSUtils.getCurrentOS() == OS.WINDOWS) { setBounds(100, 100, 842, 480); } else { setBounds(100, 100, 850, 480); } panel.setBounds(0, 0, 850, 480); panel.setLayout(null); footer.setBounds(0, 380, 850, 100); footer.setLayout(null); footer.setBackground(LauncherStyle.getCurrentStyle().footerColor); tabbedPane.setBounds(0, 0, 850, 380); panel.add(tabbedPane); panel.add(footer); setContentPane(panel); // Footer // footerLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); // footerLogo.setBounds(20, 20, 42, 42); // footerLogo.addMouseListener(new MouseAdapter() { // @Override // public void mouseClicked(MouseEvent event) { // OSUtils.browse("http://www.feed-the-beast.com"); // } // }); footerCreeper.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); footerCreeper.setBounds(25, 20, 150, 42); footerCreeper.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { OSUtils.browse("http://www.mckhaos.net"); } }); dropdown_[0] = I18N.getLocaleString("PROFILE_SELECT"); dropdown_[1] = I18N.getLocaleString("PROFILE_CREATE"); String[] dropdown = concatenateArrays(dropdown_, UserManager.getNames().toArray(new String[] {})); users = new JComboBox(dropdown); if (Settings.getSettings().getLastUser() != null) { for (int i = 0; i < dropdown.length; i++) { if (dropdown[i].equalsIgnoreCase(Settings.getSettings().getLastUser())) { users.setSelectedIndex(i); } } } donate = new JButton(I18N.getLocaleString("DONATE_BUTTON")); donate.setBounds(390, 20, 80, 30); donate.setEnabled(false); donate.setToolTipText("Coming Soon..."); donate.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) {} }); users.setBounds(550, 20, 150, 30); users.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (users.getSelectedIndex() == 1) { ProfileAdderDialog p = new ProfileAdderDialog(getInstance(), true); users.setSelectedIndex(0); p.setVisible(true); } edit.setEnabled(users.getSelectedIndex() > 1); } }); edit = new JButton(I18N.getLocaleString("EDIT_BUTTON")); edit.setBounds(480, 20, 60, 30); edit.setVisible(true); edit.setEnabled(users.getSelectedIndex() > 1); edit.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (users.getSelectedIndex() > 1) { ProfileEditorDialog p = new ProfileEditorDialog(getInstance(), (String) users.getSelectedItem(), true); users.setSelectedIndex(0); p.setVisible(true); } edit.setEnabled(users.getSelectedIndex() > 1); } }); launch.setText(I18N.getLocaleString("LAUNCH_BUTTON")); launch.setBounds(711, 20, 100, 30); launch.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { doLaunch(); } }); serverbutton.setBounds(480, 20, 330, 30); serverbutton.setText(I18N.getLocaleString("DOWNLOAD_SERVER_PACK")); serverbutton.setVisible(false); serverbutton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (!ModPack.getSelectedPack().getServerUrl().isEmpty()) { if (getSelectedModIndex() >= 0) { try { String version = (Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version") || Settings.getSettings() .getPackVer() .equalsIgnoreCase("newest version")) ? ModPack.getSelectedPack().getVersion().replace(".", "_") : Settings.getSettings().getPackVer().replace(".", "_"); if (ModPack.getSelectedPack().isPrivatePack()) { OSUtils.browse( DownloadUtils.getCreeperhostLink( "privatepacks%5E" + ModPack.getSelectedPack().getDir() + "%5E" + version + "%5E" + ModPack.getSelectedPack().getServerUrl())); } else { OSUtils.browse( DownloadUtils.getCreeperhostLink( "modpacks%5E" + ModPack.getSelectedPack().getDir() + "%5E" + version + "%5E" + ModPack.getSelectedPack().getServerUrl())); } TrackerUtils.sendPageView( ModPack.getSelectedPack().getName() + " Server Download", ModPack.getSelectedPack().getName()); } catch (NoSuchAlgorithmException e) { } } } } }); mapInstall.setBounds(650, 20, 160, 30); mapInstall.setText(I18N.getLocaleString("INSTALL_MAP")); mapInstall.setVisible(false); mapInstall.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (getSelectedMapIndex() >= 0) { MapManager man = new MapManager(new JFrame(), true); man.setVisible(true); MapManager.cleanUp(); } } }); mapInstallLocation = new JComboBox(); mapInstallLocation.setBounds(480, 20, 160, 30); mapInstallLocation.setToolTipText("Install to..."); mapInstallLocation.setVisible(false); serverMap.setBounds(480, 20, 330, 30); serverMap.setText(I18N.getLocaleString("DOWNLOAD_MAP_SERVER")); serverMap.setVisible(false); serverMap.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (getSelectedMapIndex() >= 0) { try { OSUtils.browse( DownloadUtils.getCreeperhostLink( "maps%5E" + Map.getMap(LaunchFrame.getSelectedMapIndex()).getMapName() + "%5E" + Map.getMap(LaunchFrame.getSelectedMapIndex()).getVersion() + "%5E" + Map.getMap(LaunchFrame.getSelectedMapIndex()).getUrl())); } catch (NoSuchAlgorithmException e) { } } } }); tpInstall.setBounds(650, 20, 160, 30); tpInstall.setText(I18N.getLocaleString("INSTALL_TEXTUREPACK")); tpInstall.setVisible(false); tpInstall.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (getSelectedTexturePackIndex() >= 0) { TextureManager man = new TextureManager(new JFrame(), true); man.setVisible(true); } } }); tpInstallLocation = new JComboBox(); tpInstallLocation.setBounds(480, 20, 160, 30); tpInstallLocation.setToolTipText("Install to..."); tpInstallLocation.setVisible(false); tpInstallLocLbl.setText("Install to..."); tpInstallLocLbl.setBounds(480, 20, 80, 30); tpInstallLocLbl.setVisible(false); footer.add(edit); footer.add(users); footer.add(footerLogo); footer.add(footerCreeper); footer.add(launch); footer.add(donate); footer.add(serverbutton); footer.add(mapInstall); footer.add(mapInstallLocation); footer.add(serverMap); footer.add(tpInstall); footer.add(tpInstallLocation); newsPane = new NewsPane(); modPacksPane = new ModpacksPane(); mapsPane = new MapsPane(); tpPane = new TexturepackPane(); optionsPane = new OptionsPane(Settings.getSettings()); getRootPane().setDefaultButton(launch); updateLocale(); tabbedPane.add(newsPane, 0); tabbedPane.add(optionsPane, 1); tabbedPane.add(modPacksPane, 2); tabbedPane.add(mapsPane, 3); tabbedPane.add(tpPane, 4); setNewsIcon(); tabbedPane.setIconAt(1, new ImageIcon(this.getClass().getResource("/image/tabs/options.png"))); tabbedPane.setIconAt(2, new ImageIcon(this.getClass().getResource("/image/tabs/modpacks.png"))); tabbedPane.setIconAt(3, new ImageIcon(this.getClass().getResource("/image/tabs/maps.png"))); tabbedPane.setIconAt( 4, new ImageIcon(this.getClass().getResource("/image/tabs/texturepacks.png"))); tabbedPane.setSelectedIndex(tab); tabbedPane.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent event) { if (tabbedPane.getSelectedComponent() instanceof ILauncherPane) { ((ILauncherPane) tabbedPane.getSelectedComponent()).onVisible(); currentPane = Panes.values()[tabbedPane.getSelectedIndex()]; updateFooter(); } } }); }
/** * handles property change events * * @param evt the event * @see TagMergeModel * @see ListMergeModel * @see PropertiesMergeModel */ @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(TagMergeModel.PROP_NUM_UNDECIDED_TAGS)) { int newValue = (Integer) evt.getNewValue(); if (newValue == 0) { tabbedPane.setTitleAt(1, tr("Tags")); tabbedPane.setToolTipTextAt(1, tr("No pending tag conflicts to be resolved")); tabbedPane.setIconAt(1, mergeComplete); } else { tabbedPane.setTitleAt( 1, trn("Tags({0} conflict)", "Tags({0} conflicts)", newValue, newValue)); tabbedPane.setToolTipTextAt( 1, trn( "{0} pending tag conflict to be resolved", "{0} pending tag conflicts to be resolved", newValue, newValue)); tabbedPane.setIconAt(1, mergeIncomplete); } updateResolvedCompletely(); } else if (evt.getPropertyName().equals(ListMergeModel.FROZEN_PROP)) { boolean frozen = (Boolean) evt.getNewValue(); if (evt.getSource() == nodeListMerger.getModel() && my instanceof Way) { if (frozen) { tabbedPane.setTitleAt(2, tr("Nodes(resolved)")); tabbedPane.setToolTipTextAt( 2, tr("Merged node list frozen. No pending conflicts in the node list of this way")); tabbedPane.setIconAt(2, mergeComplete); } else { tabbedPane.setTitleAt(2, tr("Nodes(with conflicts)")); tabbedPane.setToolTipTextAt(2, tr("Pending conflicts in the node list of this way")); tabbedPane.setIconAt(2, mergeIncomplete); } } else if (evt.getSource() == relationMemberMerger.getModel() && my instanceof Relation) { if (frozen) { tabbedPane.setTitleAt(3, tr("Members(resolved)")); tabbedPane.setToolTipTextAt( 3, tr( "Merged member list frozen. No pending conflicts in the member list of this relation")); tabbedPane.setIconAt(3, mergeComplete); } else { tabbedPane.setTitleAt(3, tr("Members(with conflicts)")); tabbedPane.setToolTipTextAt( 3, tr("Pending conflicts in the member list of this relation")); tabbedPane.setIconAt(3, mergeIncomplete); } } updateResolvedCompletely(); } else if (evt.getPropertyName().equals(PropertiesMergeModel.RESOLVED_COMPLETELY_PROP)) { boolean resolved = (Boolean) evt.getNewValue(); if (resolved) { tabbedPane.setTitleAt(0, tr("Properties")); tabbedPane.setToolTipTextAt(0, tr("No pending property conflicts")); tabbedPane.setIconAt(0, mergeComplete); } else { tabbedPane.setTitleAt(0, tr("Properties(with conflicts)")); tabbedPane.setToolTipTextAt(0, tr("Pending property conflicts to be resolved")); tabbedPane.setIconAt(0, mergeIncomplete); } updateResolvedCompletely(); } else if (PropertiesMergeModel.DELETE_PRIMITIVE_PROP.equals(evt.getPropertyName())) { for (IConflictResolver resolver : conflictResolvers) { resolver.deletePrimitive((Boolean) evt.getNewValue()); } } }
public static void createTabItem(ActionContext actionContext) { Thing self = (Thing) actionContext.get("self"); JTabbedPane parent = (JTabbedPane) actionContext.get("parent"); Thing thing = self.getThing("Component@0"); if (thing != null) { try { Bindings bindings = actionContext.push(); bindings.put("parent", null); for (Thing child : thing.getChilds()) { Component c = (Component) child.doAction("create", actionContext); if (c != null) { int index = parent.getTabCount(); parent.setComponentAt(index, c); Color background = AwtCreator.createColor(thing, "background", actionContext); if (background != null) { parent.setBackgroundAt(index, background); } Icon disabledIcon = SwingCreator.createIcon(thing, "disabledIcon", actionContext); if (disabledIcon != null) { parent.setDisabledIconAt(index, disabledIcon); } Integer displayedMnemonicIndex = JavaCreator.createInteger(thing, "displayedMnemonicIndex"); if (displayedMnemonicIndex != null) { parent.setDisplayedMnemonicIndexAt(index, displayedMnemonicIndex); } Boolean enabled = JavaCreator.createBoolean(thing, "enabled"); if (enabled != null) { parent.setEnabledAt(index, enabled); } Color foreground = AwtCreator.createColor(thing, "foreground", actionContext); if (foreground != null) { parent.setForeground(foreground); } Icon icon = SwingCreator.createIcon(thing, "icon", actionContext); if (icon != null) { parent.setIconAt(index, icon); } Integer mnemonic = AwtCreator.createMnemonic(thing, "mnemonic"); if (mnemonic != null) { parent.setMnemonicAt(index, mnemonic); } Boolean selected = JavaCreator.createBoolean(thing, "selected"); if (selected != null && selected) { parent.setSelectedIndex(index); } String title = JavaCreator.createText(thing, "title", actionContext); if (title != null) { parent.setTitleAt(index, title); } String toolTipText = JavaCreator.createText(thing, "toolTipText", actionContext); if (toolTipText != null) { parent.setToolTipTextAt(index, toolTipText); } break; } } } finally { actionContext.pop(); } } }