Java Code Examples for org.jdesktop.swingx.JXPanel#add()

The following examples show how to use org.jdesktop.swingx.JXPanel#add() . 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: RedisCleanService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public RedisCleanService(Jedis jedis) {
	this.treeTableModel = treeTableModel;
	this.jedis = jedis;
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");

	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
 
Example 2
Source File: RedisRefreshService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public RedisRefreshService(RedisTreeTableModel treeTableModel, String host, int port) {
	this.treeTableModel = treeTableModel;
	this.host = host;
	this.port = port;
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");

	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
 
Example 3
Source File: ShopDataPriceSaveService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public ShopDataPriceSaveService(ShopDataPriceResultModel model) {
	this.model = model;
	this.count = model.getRowCount();
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	this.dialog = new JDialog();
	this.dialog.add(panel);
	this.dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	this.dialog.setLocation(p);
	this.dialog.setModal(true);
	this.dialog.setResizable(false);
	this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	
	simpleTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_SIMPLE, 30);
	normalTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_NORMAL, 100);
	solidTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_SOLID, 200);
	eternalTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_ETERNAL, Integer.MAX_VALUE);
}
 
Example 4
Source File: WeaponDataSaveService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public WeaponDataSaveService(
		Collection<WeaponPojo> weapons, 
		String targetDatabase, String targetNamespace, String targetCollection) {
	this.weapons = weapons;
	this.targetDatabase = targetDatabase;
	this.targetNamespace = targetNamespace;
	this.targetCollection = targetCollection;
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
}
 
Example 5
Source File: ShopDataPriceFromDBSaveService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public ShopDataPriceFromDBSaveService(ShopDataPriceResultModel model) {
	this.model = model;
	this.count = model.getRowCount();
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	this.dialog = new JDialog();
	this.dialog.add(panel);
	this.dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	this.dialog.setLocation(p);
	this.dialog.setModal(true);
	this.dialog.setResizable(false);
	this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	
	simpleTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_SIMPLE, 30);
	normalTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_NORMAL, 100);
	solidTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_SOLID, 200);
	eternalTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_ETERNAL, Integer.MAX_VALUE);
}
 
Example 6
Source File: RestoreMongoConfigService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public RestoreMongoConfigService(File backupDir, boolean clean, String[] backupCollections) {
	this.backupDir = backupDir;
	this.backupDir.getParentFile().mkdirs();
	this.cleanOldData = clean;
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	this.backupCollections = backupCollections;
}
 
Example 7
Source File: BackupMongoConfigService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public BackupMongoConfigService(File backupDir, String[] backupCollections) {
	this.backupDir = backupDir;
	this.backupDir.getParentFile().mkdirs();
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	
	this.backupCollections = backupCollections;
}
 
Example 8
Source File: PushDialog.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public void init() {
	this.setTitle("消息管理");
	this.setSize(500, 300);
	Point p = WindowUtils.getPointForCentering(this);
	this.setLocation(p);
	this.setModal(true);

	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	this.infoField.setText("");
	
	JXPanel loginPanel = new JXPanel(new MigLayout("wrap 2, gap 10px", "[45%][55%]"));
	loginPanel.add(this.statusLabel, "span");
	loginPanel.add(this.infoField,   "span, growx");
	loginPanel.setBorder(BorderFactory.createTitledBorder("PUSH"));
					
	JXPanel panel = new JXPanel(new MigLayout("wrap 1, gap 10px", "[100%]"));
	this.setLayout(new MigLayout("wrap 1"));
	panel.add(loginPanel, "growx");
	panel.add(this.okButton, "gaptop 5px, span, split 3, align center");
	panel.add(this.cancelButton);

	this.add(panel, "width 100%, height 100%");
}
 
Example 9
Source File: Stacker.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
 * Fades in the specified message component in the top layer of this
 * layered pane.
 * @param message the component to be displayed in the message layer
 * @param finalAlpha the alpha value of the component when fade in is complete
 */
public void showMessageLayer(JComponent message, final float finalAlpha) {
    messageLayer = new JPanel();
    messageLayer.setOpaque(false);
    GridBagLayout gridbag = new GridBagLayout();
    messageLayer.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;

    messageAlpha = new JXPanel();
    messageAlpha.setOpaque(false);
    messageAlpha.setAlpha(0.0f);
    gridbag.addLayoutComponent(messageAlpha, c);
    messageLayer.add(messageAlpha);
    messageAlpha.add(message);

    add(messageLayer, JLayeredPane.POPUP_LAYER);
    revalidate();
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Animator animator = new Animator(2000,
                    new PropertySetter(messageAlpha, "alpha", 0.0f, finalAlpha));
            animator.setStartDelay(200);
            animator.setAcceleration(.2f);
            animator.setDeceleration(.5f);
            animator.start();
        }
    });
}
 
Example 10
Source File: ManageAccountStatusDialog.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public void init() {
	this.setTitle("管理账户状态");
	this.setSize(320, 430);
	Point p = WindowUtils.getPointForCentering(this);
	this.setLocation(p);
	this.setModal(true);
	this.statusField.setActionCommand(CMD_STATUS_SELECT);
	this.statusField.addActionListener(this);
	this.statusField.setSelectedIndex(0);
	
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	this.previewButton.setActionCommand(CMD_PREVIEW);
	this.previewButton.addActionListener(this);
	
	JXPanel loginPanel = new JXPanel(new MigLayout("wrap 2, gap 10px", "[45%][55%]"));
	loginPanel.add(this.statusLabel, "sg lbl");
	loginPanel.add(this.statusField, "sg fd, grow");
	loginPanel.add(this.descField, "span, grow");
	loginPanel.add(this.previewButton, "gaptop 5px, span, split 3, align center");		
	loginPanel.setBorder(BorderFactory.createTitledBorder("登陆管理"));
					
	JXPanel panel = new JXPanel(new MigLayout("wrap 1, gap 10px", "[100%]"));
	this.setLayout(new MigLayout("wrap 1"));
	panel.add(loginPanel);
	panel.add(this.okButton, "gaptop 5px, span, split 3, align center");
	panel.add(this.cancelButton);

	this.add(panel, "width 100%, height 100%");
}
 
Example 11
Source File: Stacker.java    From Darcula with Apache License 2.0 5 votes vote down vote up
/**
 * Fades in the specified message component in the top layer of this
 * layered pane.
 * @param message the component to be displayed in the message layer
 * @param finalAlpha the alpha value of the component when fade in is complete
 */
public void showMessageLayer(JComponent message, final float finalAlpha) {
    messageLayer = new JPanel();
    messageLayer.setOpaque(false);
    GridBagLayout gridbag = new GridBagLayout();
    messageLayer.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;

    messageAlpha = new JXPanel();
    messageAlpha.setOpaque(false);
    messageAlpha.setAlpha(0.0f);
    gridbag.addLayoutComponent(messageAlpha, c);
    messageLayer.add(messageAlpha);
    messageAlpha.add(message);

    add(messageLayer, JLayeredPane.POPUP_LAYER);
    revalidate();
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Animator animator = new Animator(2000,
                    new PropertySetter(messageAlpha, "alpha", 0.0f, finalAlpha));
            animator.setStartDelay(200);
            animator.setAcceleration(.2f);
            animator.setDeceleration(.5f);
            animator.start();
        }
    });
}
 
Example 12
Source File: ShopDataImportItemPriceService.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public ShopDataImportItemPriceService() {
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	this.dialog = new JDialog();
	this.dialog.add(panel);
	this.dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	this.dialog.setLocation(p);
	this.dialog.setModal(true);
	this.dialog.setResizable(false);
	this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	this.progressBar.setIndeterminate(true);
}
 
Example 13
Source File: WeaponBalanceTestService.java    From gameserver with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<Integer> chunks) {
	if ( stage == Stage.INIT ) {
		panel = new JXPanel();
		panel.setLayout(new MigLayout("wrap 1"));
		panel.add(label, "growx, wrap 20");
		panel.add(progressBar, "grow, push");
		
		dialog.add(panel);
		dialog.setSize(300, 120);
		Point p = WindowUtils.getPointForCentering(dialog);
		dialog.setLocation(p);
		dialog.setModal(true);
		dialog.setResizable(false);
		dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
		
		label.setFont(MainFrame.BIG_FONT);
		progressBar.setMaximum(count);
		progressBar.setStringPainted(true);
		
		dialog.setVisible(true);
	} else if ( stage == Stage.DO_BALANCE_TEST ) {
		label.setText("正在模拟战斗...");
		if ( chunks != null && chunks.size()>0 ) {
			int percent = chunks.get(chunks.size()-1);
			progressBar.setValue(percent);
		}
	}
}
 
Example 14
Source File: WeaponDataGeneratorService.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public WeaponDataGeneratorService(List<String> namePrefixes, List<Integer> dprList, double[] params) {
	this.origWeaponList = new ArrayList<WeaponPojo>();
	List<DBObject> list = MongoUtil.queryAllFromMongo(null, database, namespace, "equipments", null);
	for ( DBObject obj : list ) {
		WeaponPojo weapon = (WeaponPojo)MongoUtil.constructObject(obj);
		this.origWeaponList.add(weapon);
	}
	Collections.sort(this.origWeaponList);
	
	if ( namePrefixes != null ) {
		this.namePrefixes.addAll(namePrefixes);
	}
	if ( dprList != null ) {
		this.dprList.addAll(dprList);
	}
	
	attackUnit = params[0];
	defendUnit = params[1];
	luckUnit = params[2];
	agilityUnit = params[3];
	
	panel = new JXPanel();
	panel.setLayout(new MigLayout("wrap 1"));
	panel.add(label, "growx, wrap 20");
	panel.add(progressBar, "grow, push");
	
	dialog = new JDialog();
	dialog.add(panel);
	dialog.setSize(300, 120);
	Point p = WindowUtils.getPointForCentering(dialog);
	dialog.setLocation(p);
	dialog.setModal(true);
	dialog.setResizable(false);
	dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	
	this.progressBar.setIndeterminate(true);
}
 
Example 15
Source File: DownloadIconsService.java    From gameserver with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(List<Integer> chunks) {
	if ( stage == Stage.GET_NUM_OF_ICONS ) {
		panel = new JXPanel();
		panel.setLayout(new MigLayout("wrap 1"));
		panel.add(label, "growx, wrap 20");
		panel.add(progressBar, "grow, push");
		
		dialog = new JDialog();
		dialog.add(panel);
		dialog.setSize(300, 120);
		Point p = WindowUtils.getPointForCentering(dialog);
		dialog.setLocation(p);
		dialog.setModal(true);
		dialog.setResizable(false);
		dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
		dialog.setVisible(true);
		
		label.setText("正在获取图标列表...");
		label.setFont(MainFrame.BIG_FONT);
		progressBar.setIndeterminate(true);
	} else if ( stage == Stage.GOT_NUM_OF_ICONS ) {
		label.setFont(MainFrame.BIG_FONT);
		label.setText("总图标数量: " + icons.size());
		label.repaint();
		progressBar.setIndeterminate(false);
		progressBar.setMinimum(0);
		progressBar.setMaximum(icons.size());
		progressBar.setStringPainted(true);
	} else if ( stage == Stage.DOWNLOAD_ICONS ) {
		if ( chunks != null && chunks.size()>0 ) {
			int percent = chunks.get(chunks.size()-1);
			progressBar.setValue(percent);
		}
	} else if ( stage == Stage.INITIAL_EQUIPS ) {
		label.setText("正在初始化装备数据...");
		progressBar.setIndeterminate(true);
	}
}
 
Example 16
Source File: Stacker.java    From littleluck with Apache License 2.0 5 votes vote down vote up
/**
 * Fades in the specified message component in the top layer of this
 * layered pane.
 * @param message the component to be displayed in the message layer
 * @param finalAlpha the alpha value of the component when fade in is complete
 */
public void showMessageLayer(JComponent message, final float finalAlpha) {
    messageLayer = new JPanel();
    messageLayer.setOpaque(false);
    GridBagLayout gridbag = new GridBagLayout();
    messageLayer.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;

    messageAlpha = new JXPanel();
    messageAlpha.setOpaque(false);
    messageAlpha.setAlpha(0.0f);
    gridbag.addLayoutComponent(messageAlpha, c);
    messageLayer.add(messageAlpha);
    messageAlpha.add(message);

    add(messageLayer, JLayeredPane.POPUP_LAYER);
    revalidate();
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Animator animator = new Animator(2000,
                    new PropertySetter(messageAlpha, "alpha", 0.0f, finalAlpha));
            animator.setStartDelay(200);
            animator.setAcceleration(.2f);
            animator.setDeceleration(.5f);
            animator.start();
        }
    });
}
 
Example 17
Source File: AddItemToBagDialog.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public void init() {
	this.setSize(800, 600);
	Point c = WindowUtils.getPointForCentering(this);
	this.setLocation(c);
	
	selectPanel.addListSelectionListener(this);
	selectPanel.getList().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	
	enhanceField.setEditorKit(new HTMLEditorKit());
	enhanceField.setEditable(false);
	enhanceField.setCaretPosition(0);
	
	JXPanel panel = new JXPanel();
	this.idBtn.setEnabled(false);
	this.nameBtn.setEnabled(false);
	this.durationBtn.setEnabled(false);
	
	panel.setLayout(new MigLayout("wrap 4, ins panel"));
	panel.add(idLbl, "sg label, push");
	panel.add(idBtn, "sg field, push");
	panel.add(nameLbl, "sg label, push");
	panel.add(nameBtn, "sg field, push");
	panel.add(propIndateLbl, "sg label, push");
	panel.add(propIndateBtn, "sg field, push");
	panel.add(propUsedTimeLbl, "sg label, push");
	panel.add(propUsedTimeBtn, "sg field, push");
	panel.add(durationLbl, "sg label, push");
	panel.add(durationBtn, "sg field, push");
	panel.add(countLbl, "sg label, push");
	panel.add(countBtn, "sg field, push");
	panel.add(levelLbl, "sg label, push");
	panel.add(levelBtn, "sg field, push");
	panel.add(attackLevLbl, "sg label, push");
	panel.add(attackLevBtn, "sg field, push");
	panel.add(defendLevLbl, "sg label, push");
	panel.add(defendLevBtn, "sg field, push");
	panel.add(agilityLevLbl, "sg label, push");
	panel.add(agilityLevBtn, "sg field, push");
	panel.add(luckLevLbl, "sg label, push");
	panel.add(luckLevBtn, "sg field, push");
	
	panel.add(attackBaseLbl, "sg label, push");
	panel.add(attackBaseBtn, "sg field, push");
	panel.add(defendBaseLbl, "sg label, push");
	panel.add(defendBaseBtn, "sg field, push");
	panel.add(agilityBaseLbl, "sg label, push");
	panel.add(agilityBaseBtn, "sg field, push");
	panel.add(luckBaseLbl, "sg label, push");
	panel.add(luckBaseBtn, "sg field, push");
	
	panel.add(bloodLevLbl, "sg label, push");
	panel.add(bloodLevBtn, "sg field, push");
	panel.add(bloodPercentLbl, "sg label, push");
	panel.add(bloodPercentBtn, "sg field, push");
	panel.add(thewLevLbl, "sg label, push");
	panel.add(thewLevBtn, "sg field, push");
	panel.add(damageLevLbl, "sg label, push");
	panel.add(damageLevBtn, "sg field, push");
	panel.add(valuetypeLbl, "sg label, push");
	panel.add(valuetypeBtn, "sg field, push");
	panel.add(bandedLbl, "sg label, push");
	panel.add(bandedBtn, "sg field, push");
	panel.add(colorLbl, "sg label, push");
	panel.add(colorBtn, "sg field, push");
	panel.add(qualityLbl, "sg label, push");
	panel.add(qualityBtn, "sg field, push");
	panel.add(strengthLvlLbl, "sg label, push");
	panel.add(strengthLvField, "sg field, push");
	panel.add(addTimeStampLbl, "sg label, push");
	panel.add(addTimeStampFd, "sg field, push");
	panel.add(bandedUserNameLbl, "sg label, push");
	panel.add(bandedUserNameFd, "sg field, push");
	panel.add(bandedLbl, "sg label, push");
	panel.add(bandedBtn, "sg field, push");
	panel.add(enhanceField, "newline, spanx 2, grow");
	panel.add(slotLbl, "spanx, split 3");
	panel.add(slotField, "sg field");
	panel.add(slotButton, "");
	
	this.slotButton.setActionCommand(SLOT_CMD);
	this.slotButton.addActionListener(this);
	
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	JXPanel btnPanel = new JXPanel();
	btnPanel.add(okButton);
	btnPanel.add(cancelButton);
	
	this.setLayout(new MigLayout(""));
	this.add(panel, "dock center, width 60%");
	this.add(selectPanel, "dock east, width 40%, height 100%");
	this.add(btnPanel, "dock south, width 60%");
	
	this.setModal(true);
	
	updateStatus();
}
 
Example 18
Source File: AddOrEditRewardDialog.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public void init() {
	if (!createdNew) {
		this.idField.setEnabled(false);
	}
	this.idField.setColumns(20);
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	if ( this.rewardPojo != null ) {
		updateRewardPojo();
	}
	
	this.setSize(800, 600);
	this.setResizable(true);
	Point c = WindowUtils.getPointForCentering(this);
	this.setLocation(c);
	this.setModal(true);
	
	JXPanel pojoPanel = new JXPanel();
	pojoPanel.setBorder(BorderFactory.createTitledBorder("奖励配置"));
	pojoPanel.setLayout(new MigLayout("wrap 4",
			//column
			"[][]30[][]",
			"10"
			));
	pojoPanel.add(idLbl, "sg lbl");
	pojoPanel.add(idField, "sg fd, growx");
	pojoPanel.add(includeLbl, "span 2 1");
	pojoPanel.add(nameLbl, "sg lbl");
	pojoPanel.add(nameField, "sg fd");
	pojoPanel.add(includeField, "span 2 4");
	pojoPanel.add(happenRatioLbl, "sg lbl");
	pojoPanel.add(happenRatioField, "sg fd");
	pojoPanel.add(startMillisLbl, "sg lbl");
	pojoPanel.add(startMillisField, "sg fd");
	pojoPanel.add(endMillisLbl, "sg lbl");
	pojoPanel.add(endMillisField, "sg fd");
	
	this.setLayout(new MigLayout("wrap 1, ins 5px"));
	this.add(pojoPanel, "width 100%, height 50%");
	
	rewardPanel.setBorder(BorderFactory.createTitledBorder("奖励内容"));
	
	this.add(rewardPanel, "width 100%, height 50%");

	this.add(okButton, "split 2, align center");
	this.add(cancelButton, "");
}
 
Example 19
Source File: TaskShopDataGeneratorPanel.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public void init() {
	this.goldenToPowerField.setColumns(20);
	this.goldenToPowerField.setText("2");
	this.medalToPowerField.setText("0.4");
	this.voucherToPowerField.setText("1.0");
	this.yuanbaoToPowerField.setText("0.2");
	this.myTable.setEnableAddRow(false);
	this.myTable.setEnableDelRow(true);
	this.myTable.setEnableRrefresh(false);
	this.myTable.setTableModel(model);
	this.printPriceButton.addActionListener(this);
	this.printPriceButton.setActionCommand(COMMAND_PRINT_PRICE);
	this.savePriceButton.addActionListener(this);
	this.savePriceButton.setActionCommand(COMMAND_SAVE_PRICE);
	this.saveConfigButton.addActionListener(this);
	this.saveConfigButton.setActionCommand(COMMAND_SAVE_CONFIG);
	this.importItemButton.addActionListener(this);
	this.importItemButton.setActionCommand(COMMAND_IMPORT_ITEM);
	this.randomMinField.setText("0");
	this.randomMaxField.setText("0");
	
	int simpleTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_SIMPLE, 30);
	int normalTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_NORMAL, 100);
	int solidTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_SOLID, 200);
	int eternalTimes = GameDataManager.getInstance().getGameDataAsInt(GameDataKey.WEAPON_INDATE_ETERNAL, Integer.MAX_VALUE);
	this.simpleTimesField.setText(String.valueOf(simpleTimes));
	this.normalTimesField.setText(String.valueOf(normalTimes));
	this.solidTimesField.setText(String.valueOf(solidTimes));
	this.eternalTimesField.setText(String.valueOf(eternalTimes));
	this.simpleTimesDiscountField.setText("1.0");
	this.normalTimesDiscountField.setText("3.0");
	this.solidTimesDiscountField.setText("5.0");
	this.eternalTimesDiscountField.setText("10.0");
	
	JXPanel pricePanel = new JXPanel();
	pricePanel.setBorder(BorderFactory.createTitledBorder("设定单位DPR对应的价格参数"));
	pricePanel.setLayout(new MigLayout("wrap 8"));
	pricePanel.add(goldenToPowerLbl, "sg lbl");
	pricePanel.add(goldenToPowerField, "sg field");
	pricePanel.add(medalToPowerLbl, "sg lbl");
	pricePanel.add(medalToPowerField, "sg field");
	pricePanel.add(voucherToPowerLbl, "sg lbl");
	pricePanel.add(voucherToPowerField, "sg field");
	pricePanel.add(yuanbaoToPowerLbl, "sg lbl");
	pricePanel.add(yuanbaoToPowerField, "sg field");
	pricePanel.add(randomRangeLbl, "sg lbl");
	pricePanel.add(randomMinField, "sg field");
	pricePanel.add(randomRangeToLbl, "sg lbl");
	pricePanel.add(randomMaxField, "sg field");
	
	JXPanel qualityPanel = new JXPanel();
	qualityPanel.setBorder(BorderFactory.createTitledBorder("设定四种品质武器的有效次数和价格折扣"));
	qualityPanel.setLayout(new MigLayout("wrap 8"));
	qualityPanel.add(simpleTimesLbl, "sg lbl");
	qualityPanel.add(simpleTimesField, "sg field");
	qualityPanel.add(normalTimesLbl, "sg lbl");
	qualityPanel.add(normalTimesField, "sg field");
	qualityPanel.add(solidTimesLbl, "sg lbl");
	qualityPanel.add(solidTimesField, "sg field");
	qualityPanel.add(eternalTimesLbl, "sg lbl");
	qualityPanel.add(eternalTimesField, "sg field");
	
	qualityPanel.add(simpleTimesDiscountLbl, "sg lbl");
	qualityPanel.add(simpleTimesDiscountField, "sg field");
	qualityPanel.add(normalTimesDiscountLbl, "sg lbl");
	qualityPanel.add(normalTimesDiscountField, "sg field");
	qualityPanel.add(solidTimesDiscountLbl, "sg lbl");
	qualityPanel.add(solidTimesDiscountField, "sg field");
	qualityPanel.add(eternalTimesDiscountLbl, "sg lbl");
	qualityPanel.add(eternalTimesDiscountField, "sg field");
	
	this.setLayout(new MigLayout("wrap 2"));
	this.add(pricePanel, "span, width 100%");
	this.add(qualityPanel, "span, width 100%");
	this.add(printPriceButton, "span, split 4, align center");
	this.add(savePriceButton, "");
	this.add(importItemButton, "");
	this.add(saveConfigButton, "");
	this.add(myTable, "newline, span, width 100%, height 80%");
}
 
Example 20
Source File: ManageLoginStatusDialog.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public void init() {
	this.setTitle("管理登陆状态");
	this.setSize(320, 430);
	Point p = WindowUtils.getPointForCentering(this);
	this.setLocation(p);
	this.setModal(true);
	this.statusField.setActionCommand(CMD_STATUS_SELECT);
	this.statusField.addActionListener(this);
	this.statusField.setSelectedIndex(user.getLoginStatus().ordinal());
	try {
		Jedis jedis = AdminJedis.getInstance().getJedis();
		Long ttlLong = jedis.ttl(LoginManager.getInstance().getUserPauseKey(user.getUsername()));
		if ( ttlLong != null && ttlLong.intValue()>0 ) {
			this.valueField.setValue(ttlLong.intValue());
		} else {
			this.valueField.setValue(0);
			if ( user.getLoginStatus() == UserLoginStatus.PAUSE ) {
				this.statusField.setSelectedIndex(0);
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	this.descField.setText(user.getLoginStatusDesc());
	switch ( user.getStatus() ) {
		case NORMAL:
			this.chatField.setSelectedIndex(0);
			break;
		case CHAT_DISABLE:
			this.chatField.setSelectedIndex(1);
			break;
	}
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	this.previewButton.setActionCommand(CMD_PREVIEW);
	this.previewButton.addActionListener(this);
	
	JXPanel loginPanel = new JXPanel(new MigLayout("wrap 2, gap 10px", "[45%][55%]"));
	loginPanel.add(this.statusLabel, "sg lbl");
	loginPanel.add(this.statusField, "sg fd, grow");
	loginPanel.add(this.valueField, "sg fd, grow");
	loginPanel.add(this.timeUnitField, "sg fd, grow");
	loginPanel.add(this.descField, "span, grow");
	loginPanel.add(this.previewButton, "gaptop 5px, span, split 3, align center");		
	loginPanel.setBorder(BorderFactory.createTitledBorder("登陆管理"));
					
	JXPanel chatPanel = new JXPanel(new MigLayout("wrap 2, gap 10px", "[45%][55%]"));
	chatPanel.setBorder(BorderFactory.createTitledBorder("聊天管理"));
	chatPanel.add(this.chatLabel, "sg lbl");
	chatPanel.add(this.chatField, "sg fd, grow");
	
	JXPanel panel = new JXPanel(new MigLayout("wrap 1, gap 10px", "[100%]"));
	this.setLayout(new MigLayout("wrap 1"));
	panel.add(loginPanel);
	panel.add(chatPanel);
	panel.add(this.okButton, "gaptop 5px, span, split 3, align center");
	panel.add(this.cancelButton);

	this.add(panel, "width 100%, height 100%");
}