org.jdesktop.swingx.JXButton Java Examples

The following examples show how to use org.jdesktop.swingx.JXButton. 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: UserBagDialog.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public void updateWearStatus() {
	List<PropData> wearedItem = bag.getWearPropDatas();
	for ( int i = 1; i<PropDataEquipIndex.values().length; i++ ) {
		PropData propData = wearedItem.get(i);
		if ( wearBtns[i] == null ) {
			wearBtns[i] = new JXButton();
			wearBtns[i].setActionCommand(PropDataEquipIndex.values()[i].name());
			wearBtns[i].addActionListener(this);
		}
		if ( propData != null ) {
			WeaponPojo weapon = EquipManager.getInstance().getWeaponById(propData.getItemId());
			wearBtns[i].setIcon(MainFrame.ICON_MAPS.get(weapon.getIcon()));
			wearBtns[i].setText(propData.getName());
		} else {
			wearBtns[i].setIcon(null);
			wearBtns[i].setText(PropDataEquipIndex.values()[i].name());
		}
	}
}
 
Example #2
Source File: ListSelectDialog.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public ListSelectDialog(DefaultListModel listModel, ListCellRenderer cellRender) {
	this.listModel = listModel;
	
	list.setModel(listModel);
	list.setCellRenderer(cellRender);
	list.setSortable(true);
	list.setRolloverEnabled(true);
	list.addHighlighter(HighlighterFactory.createAlternateStriping());
	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	JScrollPane pane = new JScrollPane(list);
	
	this.setMinimumSize(new Dimension(250, 400));
	this.setModal(true);
	this.setLayout(new MigLayout("wrap 1"));
	this.add(pane, "width 100%, height 85%, grow");
	this.add(new JXLabel("用Ctrl-F可以搜索列表"));
	JXButton okButton = new JXButton("确定");
	okButton.addActionListener(this);
	this.add(okButton, "align center");
	this.setLocation((MainFrame.screenWidth-200)/2, (MainFrame.screenHeight-400)/2);
	this.setVisible(true);
}
 
Example #3
Source File: DSWorkbenchReportFrame.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
/**
 * Factory a new button
 */
private JXButton factoryButton(String pIconResource, String pTooltip, MouseListener pListener) {
    JXButton button = new JXButton(new ImageIcon(DSWorkbenchAttackFrame.class.getResource(pIconResource)));
    if (pTooltip != null) {
        button.setToolTipText("<html><div width='150px'>" + pTooltip + "</div></html>");
    }
    button.addMouseListener(pListener);
    return button;
}
 
Example #4
Source File: DSWorkbenchAttackFrame.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
/**
 * Factory a new button
 */
private JXButton factoryButton(String pIconResource, String pTooltip, MouseListener pListener) {
    JXButton button = new JXButton(new ImageIcon(DSWorkbenchAttackFrame.class.getResource(pIconResource)));
    if (pTooltip != null) {
        button.setToolTipText("<html><div width='150px'>" + pTooltip + "</div></html>");
    }
    button.addMouseListener(pListener);
    return button;
}
 
Example #5
Source File: RunnerSetting.java    From SmartTomcat with Apache License 2.0 4 votes vote down vote up
public JXButton getConfigrationButton() {
    return configrationButton;
}
 
Example #6
Source File: TomcatSettingsEditor.java    From SmartTomcat with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
protected JComponent createEditor() {

    ComboboxWithBrowseButton tomcatField = runnerSetting.getTomcatField();
    TextFieldWithBrowseButton docBaseField = runnerSetting.getDocBaseField();

    JTextField contextPathField = runnerSetting.getContextPathField();
    JFormattedTextField portField = runnerSetting.getPortField();
    JFormattedTextField adminPort = runnerSetting.getAdminPort();

    JXButton configrationButton = runnerSetting.getConfigrationButton();
    configrationButton.addActionListener(e -> ShowSettingsUtil.getInstance().showSettingsDialog(project, TomcatSettingConfigurable.class));


    VirtualFile baseDir = VirtualFileManager.getInstance().getFileSystem("file").findFileByPath(project.getBasePath());

    FileChooserDescriptor chooserDescriptor = new IgnoreOutputFileChooserDescriptor(project).withRoots(baseDir);
    docBaseField.addBrowseFolderListener("webapp", "Choose Web Folder", project, chooserDescriptor);
    docBaseField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent documentEvent) {

            if (!documentEvent.getType().equals(DocumentEvent.EventType.REMOVE)) {
                String text = docBaseField.getText();
                if (text != null && !text.trim().equals("")) {
                    VirtualFile fileByIoFile = LocalFileSystem.getInstance().findFileByIoFile(new File(text));

                    Module module = ModuleUtilCore.findModuleForFile(fileByIoFile, project);
                    String contextPath = module == null ? "/" : "/" + module.getName();
                    contextPathField.setText(contextPath);
                }
            }

        }
    });

    portField.setValue(8080);
    adminPort.setValue(8005);
    DefaultFormatterFactory tf = new DefaultFormatterFactory();
    NumberFormat format = NumberFormat.getInstance();
    format.setGroupingUsed(false);
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setValueClass(Integer.class);
    formatter.setMinimum(0);
    formatter.setMaximum(65535);
    tf.setDefaultFormatter(formatter);
    portField.setFormatterFactory(tf);
    adminPort.setFormatterFactory(tf);

    return runnerSetting.getMainPanel();
}
 
Example #7
Source File: MainGui.java    From OpenID-Attacker with GNU General Public License v2.0 4 votes vote down vote up
private void removeBackgroundFromButton(JXButton button) {
    button.setHorizontalAlignment(SwingConstants.LEFT);
    button.setBorder(null);
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
}