com.alee.laf.label.WebLabel Java Examples

The following examples show how to use com.alee.laf.label.WebLabel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ADBPullFileMonitor.java    From CXTouch with GNU General Public License v3.0 6 votes vote down vote up
private void initView() {
    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.setBorder(BorderFactory.createEmptyBorder(6, 4, 6, 4));

    //title label
    titleText = new WebLabel(" ");
    contentPane.add(titleText, BorderLayout.NORTH);
    //progress bar
    progressBar = new WebProgressBar() {
        @Override
        public Dimension getPreferredSize ()
        {
            final Dimension ps = super.getPreferredSize ();
            if ( preferredProgressWidth > 0 )
            {
                ps.width = preferredProgressWidth;
            }
            return ps;
        }
    };
    progressBar.setStringPainted(true);
    progressBar.setMaximum(100);
    progressBar.setMinimum(0);
    contentPane.add(progressBar, BorderLayout.CENTER);
}
 
Example #2
Source File: UACBypassPanel.java    From lnk2pwn with MIT License 6 votes vote down vote up
private WebPanel createUACCommandPanel() {
    MigLayout layout = new MigLayout("", "[grow][grow]", "[][grow]");
    WebPanel panel = new WebPanel();
    panel.setLayout(layout);
    panel.add(new WebLabel("Command"));
    panel.add(new WebLabel("Output"), "wrap");
                    
    uacCommandTextArea.setLineWrap(true);
    uacCommandTextArea.setBackground(COMMAND_BG_COLOR);
    uacCommandTextArea.setForeground(Color.WHITE);
    
    uacOuputTextArea.setLineWrap(true);
    uacOuputTextArea.setBackground(COMMAND_BG_COLOR);
    uacOuputTextArea.setForeground(Color.WHITE);
    
    WebScrollPane uacCommandAreaScroll = new WebScrollPane(uacCommandTextArea);		
    WebScrollPane uacOuputAreaScroll = new WebScrollPane(uacOuputTextArea);
    
    panel.add(uacCommandAreaScroll, "w 100%, h 100%, hmin 250");
    panel.add(uacOuputAreaScroll, "w 100%, h 100%, hmin 250");
    
    return panel;
}
 
Example #3
Source File: JFrameExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" );
    button.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            final String title = getExampleLanguagePrefix () + "content";
            final JFrame frame = new JFrame ();
            UILanguageManager.registerComponent ( frame.getRootPane (), title );
            frame.getRootPane ().putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
            frame.setIconImages ( WebLookAndFeel.getImages () );
            frame.add ( new WebLabel ( title, WebLabel.CENTER ) );
            frame.setAlwaysOnTop ( true );
            frame.setSize ( 500, 400 );
            frame.setLocationRelativeTo ( DemoApplication.getInstance () );
            frame.setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE );
            frame.setVisible ( true );
        }
    } );
    return CollectionUtils.asList ( button );
}
 
Example #4
Source File: ShortcutInfoPanel.java    From lnk2pwn with MIT License 6 votes vote down vote up
private WebPanel createShortcutDetailsPanel() {
    MigLayout layout = new MigLayout("", "[grow][grow][grow][][grow]", "");
    WebPanel panel = new WebPanel();
    panel.setLayout(layout);
    panel.add(new WebLabel("File Name"));
    panel.add(new WebLabel("Fake Extension"));
    panel.add(new WebLabel("Icon Location"));
    panel.add(new WebLabel("Icon Index"));
    panel.add(new WebLabel("Window Style"), "wrap");						
    panel.add(shortcutFileNameField, "grow");		
    panel.add(fakeExtensionField, "grow");				
    panel.add(iconPathField, "grow");
    panel.add(iconIndexField, "grow");
    panel.add(windowStyleComboBox, "grow");
    
    return panel;
}
 
Example #5
Source File: ContactListView.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
FlyweightContactItem() {
    //this.setPaintFocus(true);
    this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0));
    this.setMargin(View.MARGIN_SMALL);

    mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE);
    this.add(mAvatar, BorderLayout.WEST);

    mNameLabel = new WebLabel();
    mNameLabel.setFontSize(View.FONT_SIZE_BIG);
    mNameLabel.setDrawShade(true);

    mStatusLabel = new WebLabel();
    mStatusLabel.setForeground(Color.GRAY);
    mStatusLabel.setFontSize(View.FONT_SIZE_TINY);
    this.add(
            new GroupPanel(View.GAP_SMALL, false,
                    mNameLabel,
                    new GroupPanel(GroupingType.fillFirst,
                            Box.createGlue(), mStatusLabel)
            ), BorderLayout.CENTER);
}
 
Example #6
Source File: MainFrame.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
private void showAboutDialog() {
    WebPanel aboutPanel = new WebPanel(new GridLayout(0, 1, View.GAP_SMALL, View.GAP_SMALL));
    aboutPanel.add(new WebLabel("Kontalk Java Client v" + Kontalk.VERSION));
    WebLinkLabel linkLabel = new WebLinkLabel();
    linkLabel.setLink(View.KONTALK_SITE);
    linkLabel.setText(Tr.tr("Visit kontalk.org"));
    aboutPanel.add(linkLabel);
    WebLabel soundLabel = new WebLabel(Tr.tr("Notification sound by")+" FxProSound");
    aboutPanel.add(soundLabel);
    Icon icon = Utils.getIcon("kontalk.png");
    WebOptionPane.showMessageDialog(this,
            aboutPanel,
            Tr.tr("About"),
            WebOptionPane.INFORMATION_MESSAGE,
            icon);
}
 
Example #7
Source File: ImportDialog.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
IntroPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Get Started")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    // html tag for word wrap
    String text = "<html>"+
            Tr.tr("Welcome to the import wizard.")+" "
            +Tr.tr("To use the Kontalk desktop client you need an existing account.")+" "
            +Tr.tr("Please export the personal key files from your Android device and select them on the next page.")
            +"</html>";
    groupPanel.add(new WebLabel(text));

    this.add(groupPanel);
}
 
Example #8
Source File: ConfigurationDialog.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
PrivacyPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Privacy Settings")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mSubscriptionBox = createCheckBox(Tr.tr("Automatically grant authorization"),
             Tr.tr("Automatically grant online status authorization requests from other users"),
            mConf.getBoolean(Config.NET_AUTO_SUBSCRIPTION));
    groupPanel.add(new GroupPanel(mSubscriptionBox, new WebSeparator()));

    mChatStateBox = createCheckBox(Tr.tr("Send chatstate notification"),
            Tr.tr("Send chat activity (typing,…) to other users"),
            mConf.getBoolean(Config.NET_SEND_CHAT_STATE));
    groupPanel.add(new GroupPanel(mChatStateBox, new WebSeparator()));

    mRosterNameBox = createCheckBox(Tr.tr("Upload contact names"),
            Tr.tr("Upload your contact names to the server for client synchronization"),
            mConf.getBoolean(Config.NET_SEND_ROSTER_NAME));
    groupPanel.add(new GroupPanel(mRosterNameBox, new WebSeparator()));

    this.add(groupPanel);
}
 
Example #9
Source File: ComponentUtils.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
AttachmentPanel() {
    super(View.GAP_SMALL, false);

    this.add(mStatus = new WebLabel().setItalicFont());
    this.add(mAttLabel = new WebLinkLabel());

    mFileChooser = new WebFileChooser() {
        @Override
        public void approveSelection(){
            File f = getSelectedFile();
            if (f.exists()) {
                int option = JOptionPane.showConfirmDialog(this,
                        String.format(
                                Tr.tr("The file \"%s\" already exists, overwrite?"),
                                f.getName()),
                        Tr.tr("Overwrite File?"),
                        JOptionPane.OK_CANCEL_OPTION);
                if (option != JOptionPane.YES_OPTION)
                    return; // doing nothing means not approve
            }
            super.approveSelection();
        }
    };
}
 
Example #10
Source File: JDialogExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" );
    button.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            final Window parent = CoreSwingUtils.getNonNullWindowAncestor ( button );
            final String title = getExampleLanguagePrefix () + "content";
            final JDialog dialog = new JDialog ( parent );
            UILanguageManager.registerComponent ( dialog.getRootPane (), title );
            dialog.getRootPane ().putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
            dialog.setIconImages ( WebLookAndFeel.getImages () );
            dialog.add ( new WebLabel ( title, WebLabel.CENTER ) );
            dialog.setSize ( 500, 400 );
            dialog.setLocationRelativeTo ( DemoApplication.getInstance () );
            dialog.setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE );
            dialog.setVisible ( true );
        }
    } );
    return CollectionUtils.asList ( button );
}
 
Example #11
Source File: LazyContent.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates and returns custom {@link JComponent} for the specified {@link Throwable} cause.
 * It is displayed in {@link #container} in case data loading has failed.
 *
 * @param cause {@link Throwable} cause
 * @return custom {@link JComponent} for the specified {@link Throwable} cause
 */
@NotNull
protected JComponent createExceptionComponent ( @NotNull final Throwable cause )
{
    final String message = TextUtils.shortenText ( cause.getMessage (), 100, true );
    final WebLabel component = new WebLabel ( message, WebLabel.CENTER );
    component.onMousePress ( MouseButton.left, new MouseEventRunnable ()
    {
        @Override
        public void run ( @NotNull final MouseEvent event )
        {
            final WebPopOver info = new WebPopOver ( component );
            info.setCloseOnFocusLoss ( true );
            final WebSyntaxArea area = new WebSyntaxArea ( ExceptionUtils.getStackTrace ( cause ), 12, 60 );
            area.applyPresets ( base, viewable, hideMenu, ideaTheme, nonOpaque );
            info.add ( new WebSyntaxScrollPane ( StyleId.syntaxareaScrollUndecorated, area, false ) );
            info.show ( component, PopOverDirection.down, PopOverAlignment.centered );
        }
    } );
    return component;
}
 
Example #12
Source File: EmergencySupplyMissionCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Constructor.
 */
public EmergencySupplyMissionCustomInfoPanel() {
	// Use JPanel constructor
	super();

	// Set the layout.
	setLayout(new BorderLayout());

	// Create the emergency supplies label.
	WebLabel emergencySuppliesLabel = new WebLabel(Msg.getString("EmergencySupplyMissionCustomInfoPanel.emergencySupplies"), WebLabel.LEFT); //$NON-NLS-1$
	add(emergencySuppliesLabel, BorderLayout.NORTH);

	// Create a scroll pane for the emergency supplies table.
	WebScrollPane emergencySuppliesScrollPane = new WebScrollPane();
	emergencySuppliesScrollPane.setPreferredSize(new Dimension(-1, -1));
	add(emergencySuppliesScrollPane, BorderLayout.CENTER);

	// Create the emergency supplies table and model.
	emergencySuppliesTableModel = new EmergencySuppliesTableModel();
	WebTable emergencySuppliesTable = new WebTable(emergencySuppliesTableModel);
	emergencySuppliesScrollPane.setViewportView(emergencySuppliesTable);
}
 
Example #13
Source File: CommanderWindow.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public Component getListCellRendererComponent(
		JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
	Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

	if (value == null) {
		setText(Conversion.capitalize(prompt));
		return this;
	}

	if (c instanceof WebLabel) {

           if (isSelected) {
               //c.setBackground(Color.orange);
           } else {
               //c.setBackground(Color.white);
               //c.setBackground(new Color(51,25,0,128));
           }

       } else {
       	//c.setBackground(Color.white);
           //c.setBackground(new Color(51,25,0,128));
           c = super.getListCellRendererComponent(
                   list, value, index, isSelected, cellHasFocus);
       }
       return c;
}
 
Example #14
Source File: TabbedPaneTooltipExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns single tab content {@link JComponent}.
 *
 * @return single tab content {@link JComponent}
 */
@NotNull
protected JComponent createTabContent ()
{
    final WebStyledLabel content = new WebStyledLabel (
            DemoStyles.placeholderLabel,
            getExampleLanguageKey ( "data.content" ),
            WebLabel.CENTER
    );
    content.setFocusable ( true );
    content.addMouseListener ( new MouseAdapter ()
    {
        @Override
        public void mousePressed ( final MouseEvent e )
        {
            content.requestFocusInWindow ();
        }
    } );
    return content;
}
 
Example #15
Source File: TabPanelFavorite.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
		 * Renderer the specified Table Header cell
		 **/
		public Component getTableCellRendererComponent(JTable table,
				Object value,
				boolean isSelected,
				boolean hasFocus,
				int row,
				int column) {

			Component theResult = defaultRenderer.getTableCellRendererComponent(
					table, value, isSelected, hasFocus,
					row, column);

			if (theResult instanceof WebLabel) {
				WebLabel cell = (WebLabel) theResult;
				cell.setText((String)value);
			}

//			WebTableHeader tableHeader = table.getTableHeader();
//		    if (tableHeader != null) {
//		    	tableHeader.setForeground(TableStyle.getHeaderForegroundColor());
//		    	tableHeader.setBackground(TableStyle.getHeaderBackgroundColor());
//		    }

			return theResult;
		}
 
Example #16
Source File: ComponentUtils.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
EncryptionPanel() {
    mEncryptionIcon = new WebLabel();
    mEncryptionWarningIcon = new WebLabel(Utils.getIcon("ic_ui_warning.png"));

    this.add(mEncryptionIcon, BorderLayout.WEST);
    this.add(mEncryptionWarningIcon, BorderLayout.EAST);
}
 
Example #17
Source File: OracleWikiPage.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JComponent createLink ()
{
    final WebPanel link = new WebPanel ( StyleId.panelTransparent, new HorizontalFlowLayout ( 4, false ) );
    link.add ( new WebLabel ( DemoStyles.wikiLabel, "demo.content.example.wiki.oracle", DemoIcons.java16 ) );
    link.add ( new WebLink ( DemoStyles.wikiLink, getTitle (), new UrlLinkAction ( getAddress () ) ) );
    return link;
}
 
Example #18
Source File: ConfigurationDialog.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
MainPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Main Settings")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mTrayBox = createCheckBox(Tr.tr("Show tray icon"),
            "",
            mConf.getBoolean(Config.MAIN_TRAY));
    mTrayBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            mCloseTrayBox.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mCloseTrayBox = createCheckBox(Tr.tr("Close to tray"),
            "",
            mConf.getBoolean(Config.MAIN_TRAY_CLOSE));
    mCloseTrayBox.setEnabled(mTrayBox.isSelected());
    groupPanel.add(new GroupPanel(View.GAP_DEFAULT, mTrayBox, mCloseTrayBox));

    mEnterSendsBox = createCheckBox(Tr.tr("Enter key sends"),
            Tr.tr("Enter key sends text, Control+Enter adds new line - or vice versa"),
            mConf.getBoolean(Config.MAIN_ENTER_SENDS));
    groupPanel.add(new GroupPanel(mEnterSendsBox, new WebSeparator()));

    mShowUserBox = createCheckBox(Tr.tr("Display yourself in contacts"),
            Tr.tr("Display yourself in the contact list"),
            mConf.getBoolean(Config.VIEW_USER_CONTACT));
    groupPanel.add(new GroupPanel(mShowUserBox, new WebSeparator()));

    mHideBlockedBox = createCheckBox(Tr.tr("Hide blocked contacts"),
            Tr.tr("Hide blocked contacts in the contact list"),
            mConf.getBoolean(Config.VIEW_HIDE_BLOCKED));
    groupPanel.add(new GroupPanel(mHideBlockedBox, new WebSeparator()));

    this.add(groupPanel);
}
 
Example #19
Source File: ImportDialog.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
ResultPanel() {
    mImporter = mView.getControl().createAccountImporter();
    mImporter.addObserver(this);

    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Import results")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mResultLabel = new WebLabel();
    groupPanel.add(mResultLabel);
    mErrorLabel = new WebLabel();
    groupPanel.add(mErrorLabel);

    mPassPanel = new ComponentUtils.PassPanel(false) {
        @Override
        void onValidInput() {
            mFinishButton.setEnabled(true);
        }
        @Override
        void onInvalidInput() {
            mFinishButton.setEnabled(false);
        }
    };
    groupPanel.add(mPassPanel);

    this.add(groupPanel);
}
 
Example #20
Source File: ChatListView.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
FlyweightChatItem() {
    this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0));
    this.setMargin(View.MARGIN_DEFAULT);

    mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE);
    this.add(mAvatar, BorderLayout.WEST);

    mTitleLabel = new WebLabel();
    mTitleLabel.setFontSize(View.FONT_SIZE_BIG);
    mTitleLabel.setDrawShade(true);

    mStatusLabel = new WebLabel();
    mStatusLabel.setForeground(Color.GRAY);
    mStatusLabel.setFontSize(View.FONT_SIZE_TINY);
    this.add(mStatusLabel, BorderLayout.EAST);

    mChatStateLabel = new WebLabel();
    mChatStateLabel.setForeground(View.DARK_RED);
    mChatStateLabel.setFontSize(View.FONT_SIZE_TINY);
    mChatStateLabel.setBoldFont();
    //mChatStateLabel.setMargin(0, 5, 0, 5);

    this.add(
            new GroupPanel(View.GAP_SMALL, false,
                    mTitleLabel,
                    new GroupPanel(GroupingType.fillFirst,
                            Box.createGlue(), mStatusLabel, mChatStateLabel)
            ), BorderLayout.CENTER);
}
 
Example #21
Source File: View.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
void showPasswordDialog(boolean wasWrong) {
    WebPanel passPanel = new WebPanel();
    WebLabel passLabel = new WebLabel(Tr.tr("Please enter your key password:"));
    passPanel.add(passLabel, BorderLayout.NORTH);
    final WebPasswordField passField = new WebPasswordField();
    passPanel.add(passField, BorderLayout.CENTER);
    if (wasWrong) {
        WebLabel wrongLabel = new WebLabel(Tr.tr("Wrong password"));
        wrongLabel.setForeground(Color.RED);
        passPanel.add(wrongLabel, BorderLayout.SOUTH);
    }
    WebOptionPane passPane = new WebOptionPane(passPanel,
            WebOptionPane.QUESTION_MESSAGE,
            WebOptionPane.OK_CANCEL_OPTION);
    JDialog dialog = passPane.createDialog(mMainFrame, Tr.tr("Enter password"));
    dialog.setModal(true);
    dialog.addWindowFocusListener(new WindowAdapter() {
        @Override
        public void windowGainedFocus(WindowEvent e) {
            passField.requestFocusInWindow();
        }
    });
    // blocking
    LOGGER.info("asking for password…");
    dialog.setVisible(true);

    Object value = passPane.getValue();
    if (value != null && value.equals(WebOptionPane.OK_OPTION))
        mControl.connect(passField.getPassword());
}
 
Example #22
Source File: Notifier.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
void confirmNewKey(final Contact contact, final PGPUtils.PGPCoderKey key) {
     final boolean overwriting = contact.hasKey();

    WebPanel panel = panel(overwriting ?
            Tr.tr("Received a new public key for contact") :
            Tr.tr("Public key for contact was found"), contact);

    panel.add(new WebLabel(Tr.tr("Key fingerprint:")));
    WebTextArea fpArea = Utils.createFingerprintArea();
    fpArea.setText(Utils.fingerprint(key.fingerprint));
    panel.add(fpArea);

    String expl = overwriting ?
            Tr.tr("When declining the key, communication with this contact will be blocked.") :
            Tr.tr("When accepting the key, communication with this contact will be encrypted.");
    panel.add(textArea(expl));

    WebNotificationPopup popup = NotificationManager.showNotification(mWindow, panel,
            NotificationOption.accept, NotificationOption.decline,
            NotificationOption.cancel);
    popup.setClickToClose(false);
    popup.addNotificationListener(new NotificationListener() {
        @Override
        public void optionSelected(NotificationOption option) {
            switch (option) {
                case accept :
                    mView.getControl().acceptKey(contact, key);
                    break;
                case decline :
                    if (overwriting)
                         mView.getControl().declineKey(contact);
            }
        }
        @Override
        public void accepted() {}
        @Override
        public void closed() {}
    });
}
 
Example #23
Source File: JTooltipExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebLabel label = new WebLabel ( getPreviewLanguagePrefix () + "text" );
    return CollectionUtils.asList ( label );
}
 
Example #24
Source File: ExplorationSitesPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param siteNum the exploration site's number.
 * @param site    the exploration site coordinates.
 */
SitePanel(int siteNum, Coordinates site) {
	// Use WebPanel constructor.
	super();

	// Initialize data members.
	this.siteNum = siteNum;
	this.site = site;

	// Set the layout.
	setLayout(new GridLayout(1, 3));

	// Set the border.
	setBorder(new MarsPanelBorder());

	// Create the site number label.
	siteNumLabel = new WebLabel(" Site " + (siteNum + 1));
	add(siteNumLabel);

	// Create the site location label.
	siteLocationLabel = new WebLabel(site.getFormattedString());
	add(siteLocationLabel);

	if (siteNum > 0) {
		// Create the remove button.
		WebButton removeButton = new WebButton("Remove");
		removeButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				// Remove this site panel from the site list.
				setVisible(false);
				siteListPane.remove(getSiteNum());
				updateSiteNumbers();
				siteListPane.validate();
			}
		});
		add(removeButton);
	} else
		add(new WebPanel());
}
 
Example #25
Source File: ExplorationCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * @param siteName the site name.
 * @param completion the completion level.
 */
ExplorationSitePanel(String siteName, double completion) {
	// Use JPanel constructor.
	super();

	this.completion = completion;

	setLayout(new GridLayout(1, 2, 3, 3));

	WebPanel namePanel = new WebPanel(new FlowLayout(FlowLayout.RIGHT, 3, 3));
	namePanel.setAlignmentX(CENTER_ALIGNMENT);
	add(namePanel);

	WebLabel nameLabel = new WebLabel("  " + Conversion.capitalize(siteName), SwingConstants.RIGHT);
	nameLabel.setAlignmentX(CENTER_ALIGNMENT);
	namePanel.add(nameLabel);

	WebPanel barPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT, 3, 0));
	barPanel.setAlignmentX(CENTER_ALIGNMENT);
	add(barPanel);

	completionBar = new WebProgressBar(0, 100);
	completionBar.setAlignmentX(CENTER_ALIGNMENT);
	completionBar.setStringPainted(true);
	completionBar.setValue((int) (completion * 100D));
	barPanel.add(completionBar);
}
 
Example #26
Source File: WebPopupExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" );
    button.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            final WebPopup popup = new WebPopup ( getStyleId (), new AlignLayout () );
            popup.setPadding ( 10 );
            popup.setResizable ( true );
            popup.setDraggable ( true );

            final WebPanel container = new WebPanel ( StyleId.panelTransparent, new BorderLayout ( 5, 5 ) );

            final WebLabel label = new WebLabel ( getExampleLanguagePrefix () + "label", WebLabel.CENTER );
            container.add ( label, BorderLayout.NORTH );

            final String text = LM.get ( getExampleLanguagePrefix () + "text" );
            final WebTextField field = new WebTextField ( text, 20 );
            field.setHorizontalAlignment ( WebTextField.CENTER );
            container.add ( field, BorderLayout.CENTER );

            popup.add ( container );

            popup.pack ();
            popup.setResizable ( true );
            popup.showPopup ( button, 0, button.getHeight () );
        }
    } );
    return CollectionUtils.asList ( button );
}
 
Example #27
Source File: WebOptionPaneUI.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns new label component used for text message.
 *
 * @param body message body container
 * @param msg  message text
 * @return new label component used for text message
 */
@NotNull
protected WebLabel createMessageLabel ( @NotNull final Container body, @NotNull final String msg )
{
    final StyleId styleId = StyleId.optionpaneMessageLabel.at ( ( JComponent ) body );
    final WebLabel label = new WebLabel ( styleId, msg, JLabel.LEADING );
    label.setName ( "OptionPane.label" );
    return label;
}
 
Example #28
Source File: NoWikiPage.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JComponent createLink ()
{
    final WebPanel link = new WebPanel ( StyleId.panelTransparent, new HorizontalFlowLayout ( 4, false ) );
    link.add ( new WebLabel ( DemoStyles.wikiLabel, getTitle (), DemoIcons.github16 ) );
    return link;
}
 
Example #29
Source File: CXTooltipManager.java    From CXTouch with GNU General Public License v3.0 5 votes vote down vote up
public static WebLabel createDefaultComponent (final Icon icon, final String tooltip )
{
    final WebLabel label = new WebLabel ( tooltip, icon );
    label.setStyleId ( "custom-tooltip-label" );
    label.setFont (CXLookAndFeel.toolTipFont );
    return label;
}
 
Example #30
Source File: NotesTabPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void initializeUI() {
	uiDone = true;
	
	// Initialize location header.
	WebPanel titlePane = new WebPanel(new FlowLayout(FlowLayout.CENTER));
	topContentPanel.add(titlePane);

	WebLabel titleLabel = new WebLabel(Msg.getString("NotesTabPanel.title"), WebLabel.CENTER); //$NON-NLS-1$
	titleLabel.setFont(new Font("Serif", Font.BOLD, 16));
	// titleLabel.setForeground(new Color(102, 51, 0)); // dark brown
	titlePane.add(titleLabel);
	
	// Create notes panel
	WebPanel notesPanel = new WebPanel(new BorderLayout(5, 5));
	notesPanel.setBorder(new MarsPanelBorder());
	notesPanel.setBorder(new EmptyBorder(1, 1, 1, 1));
	centerContentPanel.add(notesPanel);
	
	notesCache = unit.getNotes();
	
	textArea = new WebTextArea(StyleId.textareaDecorated);
	notesPanel.add(textArea);
	
	if (notesCache == null || notesCache.equals(""))
		textArea.setInputPrompt("Enter Here");
	else {
		textArea.append(notesCache);
	}

}