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

The following examples show how to use org.jdesktop.swingx.JXPanel#setLayout() . 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: 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 2
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 3
Source File: EquipmentExportService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public EquipmentExportService(MyTableModel model, ShopDataPriceConfig config) {
	this.model = model;
	this.config = config;
	
	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);
}
 
Example 4
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 5
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 6
Source File: StrengthTestService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public StrengthTestService( 
		StrengthTestConfig config, MyTablePanel tablePanel) {
	this.model = model;
	this.config = config;
	this.count = config.getMaxTry();
	this.tablePanel = tablePanel;
	
	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);
			
	model = new StrengthTestResultModel();
	tablePanel.setTableModel(model);
}
 
Example 7
Source File: ShopDataPricePrintService.java    From gameserver with Apache License 2.0 6 votes vote down vote up
public ShopDataPricePrintService(MyTableModel model, ShopDataPriceConfig config) {
	this.model = model;
	this.config = config;
	
	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);
}
 
Example 8
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 9
Source File: TemplateService.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public TemplateService() {
	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);
}
 
Example 10
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 11
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 12
Source File: TaskReloadConfigPanel.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public void init() {
	JXPanel settingPanel = new JXPanel();
	TitledBorder border = BorderFactory.createTitledBorder(
			BorderFactory.createEtchedBorder(), "服务器设定");
	border.setTitleFont(MainFrame.BIG_FONT);
	settingPanel.setBorder(border);
	
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	
	settingPanel.setLayout(new MigLayout("wrap 4, gap 10px, alignx center", ""));
	
	settingPanel.add(this.lblGameServer, "sg lb");
	settingPanel.add(this.gameServerField, "sg fd, growx, pushx");
	settingPanel.add(this.lblGamePort,  "sg lb");
	settingPanel.add(this.gameServerPort, "sg fd, growx, pushx");
	
	JXPanel configPanel = new JXPanel();
	TitledBorder backupBorder =  BorderFactory.createTitledBorder("配置文件");
	backupBorder.setTitleFont(MainFrame.BIG_FONT);
	configPanel.setBorder(backupBorder);
	configPanel.setLayout(new MigLayout("wrap 4, align center"));
	JXPanel collPanel = new JXPanel();
	collPanel.setLayout(new MigLayout("wrap 4, align center"));
	collPanel.setBorder(BorderFactory.createEtchedBorder());
	for ( int i=0; i<CONFIG_NAMES.length; i++ ) {
		String collection = CONFIG_NAMES[i];
		backupCollections[i] = new JCheckBox(collection);
		collPanel.add(backupCollections[i], "sg checkbox");
	}
	configPanel.add(collPanel, "align center, width 100%");
	configPanel.add(this.okButton, "newline, span, split 2, alignx center, aligny bottom");
	
	this.setLayout(new MigLayout("wrap 1"));
	this.add(settingPanel, "width 100%");
	this.add(configPanel,  "width 100%");
}
 
Example 13
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 14
Source File: TaskEquipmentExportPanel.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.exportEquipmentButton.addActionListener(this);
	this.exportEquipmentButton.setActionCommand(COMMAND_EXPORT_EQUIPMENT);
	this.importEquipmentButton.addActionListener(this);
	this.importEquipmentButton.setActionCommand(COMMAND_IMPORT_EQUIPMENT);
	this.savePriceButton.addActionListener(this);
	this.savePriceButton.setActionCommand(COMMAND_SAVE_PRICE);
	this.savePriceButton.setEnabled(false);
	this.saveConfigButton.addActionListener(this);
	this.saveConfigButton.setActionCommand(COMMAND_SAVE_CONFIG);
	this.saveConfigButton.setEnabled(false);
	this.importItemButton.addActionListener(this);
	this.importItemButton.setActionCommand(COMMAND_IMPORT_ITEM);
	this.importItemButton.setEnabled(false);
	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(exportEquipmentButton, "span, split 5, align center");
	this.add(importEquipmentButton, "");
	this.add(savePriceButton, "");
	this.add(importItemButton, "");
	this.add(saveConfigButton, "");
	this.add(myTable, "newline, span, width 100%, height 80%");
}
 
Example 15
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 16
Source File: AddOrEditCDKeyDialog.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.cdkeyPojo != null ) {
		updateRewardPojo();
	}
	this.resetDateButton.setActionCommand(COMMAND_RESET_DATE);
	this.resetDateButton.addActionListener(this);
	
	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(channelLbl, "sg lbl");
	pojoPanel.add(channelField, "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 3, align center");
	this.add(resetDateButton, "");
	this.add(cancelButton, "");
}
 
Example 17
Source File: AddOrEditExitGameDialog.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public void init() {
	if (!createdNew) {
		this.idField.setEnabled(false);
	}
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	this.cancelButton.setActionCommand(ActionName.CANCEL.name());
	this.cancelButton.addActionListener(this);
	if ( this.exitPojo != null ) {
		updateRewardPojo();
	}
	this.resetDateButton.setActionCommand(COMMAND_RESET_DATE);
	this.resetDateButton.addActionListener(this);
	
	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(daysLbl, "sg lbl");
	pojoPanel.add(daysField, "sg fd, growx");
	pojoPanel.add(channelLbl, "sg lbl");
	pojoPanel.add(channelField, "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 3, align center");
	this.add(resetDateButton, "");
	this.add(cancelButton, "");
}
 
Example 18
Source File: UserBagDialog.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public UserBagDialog(User user) {
		this.user = user;
		this.bag  = user.getBag();
		
		currCountTf.setText(String.valueOf(bag.getCurrentCount()));
		currCountTf.setEnabled(true);
		maxCountTf.setText(String.valueOf(bag.getMaxCount()));
		maxCountTf.setEnabled(true);

		DefaultListModel listModel = new DefaultListModel();
		bagList.setModel(listModel);
		bagList.setCellRenderer(new PropDataListCellRenderer());
		bagList.setDragEnabled(true);
		bagList.setHighlighters(HighlighterFactory.createAlternateStriping());
		bagList.addMouseListener(new MouseAdapter() {

			/* (non-Javadoc)
			 * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseClicked(MouseEvent e) {
				if ( e.getClickCount() == 2 ) {
					commandWearItem();
				}
			}
			
		});
		JScrollPane bagPane = new JScrollPane(bagList);
		bagPane.setBorder(BorderFactory.createTitledBorder("玩家当前背包内容"));
		
		updateBagStatus();
		updateWearStatus();
		updateUserStatus();
		
//		this.setBorder(BorderFactory.createTitledBorder("玩家" + user.getUsername() + "背包数据"));
		this.setLayout(new MigLayout("ins 10px"));
		this.add(currCountLbl, "");
		this.add(currCountTf, "gapright 10px");
		this.add(maxCountLbl, "");
		this.add(maxCountTf, "wrap");
		
		this.add(bagPane, "dock east, width 30%, height 100%, wrap");
		JXPanel wearPanel = new JXPanel();
		wearPanel.setLayout(new MigLayout("wrap 4"));
		for ( int i=1; i<wearBtns.length; i++ ) {
			if ( i % 4 == 0 ) {
				wearPanel.add(wearBtns[i], "sg wear, wrap, height 36px");
			} else {
				wearPanel.add(wearBtns[i], "sg wear, height 36px");
			}
		}
		this.add(wearPanel, "span, align center");
		
		this.addNewItemToBagBtn.setActionCommand(COMMAND_ADD_NEW);
		this.removeItemFromBagBtn.setActionCommand(COMMAND_REMOVE_ITEM);
		this.wearBagItemBtn.setActionCommand(COMMAND_WEAR_ITEM);
		this.modiBagItemBtn.setActionCommand(COMMAND_MODIFY_ITEM);
		
		this.okButton.setActionCommand(ActionName.OK.name());
		this.cancelButton.setActionCommand(ActionName.CANCEL.name());
		
		this.addNewItemToBagBtn.addActionListener(this);
		this.removeItemFromBagBtn.addActionListener(this);
		this.wearBagItemBtn.addActionListener(this);
		this.modiBagItemBtn.addActionListener(this);
		this.okButton.addActionListener(this);
		this.cancelButton.addActionListener(this);
		
		JXPanel btnPanel = new JXPanel();
		btnPanel.setLayout(new MigLayout("wrap 4"));
		btnPanel.add(addNewItemToBagBtn, "sg btn");
		btnPanel.add(removeItemFromBagBtn, "sg btn");
		btnPanel.add(wearBagItemBtn, "sg btn");
		btnPanel.add(modiBagItemBtn, "sg btn, wrap");
		btnPanel.add(okButton, "span, split 2, align center");
		btnPanel.add(cancelButton, "");
		
		this.userStatusLbl.setBackground(Color.WHITE);
		this.userStatusLbl.setFont(MainFrame.BIG_FONT);
		this.userStatusLbl.setHorizontalTextPosition(JLabel.CENTER);
		this.userStatusLbl.setBorder(BorderFactory.createEtchedBorder());

		
		this.add(userStatusLbl, "newline, span, width 70%, height 100px, align center, wrap");
		this.add(btnPanel, "dock south, span, align center");
		
		this.setModal(true);
		this.setSize(800, 600);
		Point p = WindowUtils.getPointForCentering(this);
		this.setLocation(p);
	}
 
Example 19
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 20
Source File: AddRewardDialog.java    From gameserver with Apache License 2.0 4 votes vote down vote up
public void init() {
		this.setSize(650, 600);
		Point point = WindowUtils.getPointForCentering(this.getOwner());
		this.setLocation(point);
		this.setResizable(true);
		
		this.subjectField.setColumns(100);
		this.contentField.setColumns(100);
		this.idList.setEnabled(false);
		this.typeIdField.setEnabled(false);
		this.typeList.setActionCommand(COMMAND_TYPE);
		this.typeList.addActionListener(this);
		this.okButton.setActionCommand(COMMAND_OK);
		this.okButton.addActionListener(this);
		this.cancelButton.setActionCommand(COMMAND_CANCEL);
		this.cancelButton.addActionListener(this);
		this.countSpinner.setValue(1);
		this.attachGift.setSelected(true);
		this.attachGift.setActionCommand(COMMAND_ONLYEMAIL);
		this.attachGift.addActionListener(this);
		
		this.panel.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "escape");
		this.panel.getActionMap().put("escape", new EscapeAction());
		
		this.weaponPanel.setEnabled(true);
		this.weaponPanel.addListSelectionListener(this);
		
	  //layout
		panel.setLayout(new MigLayout("wrap 2, width 100%, gap 10px", "[25%][25%][25%][25%]"));
		if ( this.title != null ) {
			panel.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), title));
		} else {
			panel.setBorder(BorderFactory.createEtchedBorder());
		}
		panel.add(subjectLabel, "");
		panel.add(subjectField, "span, growx");
		panel.add(contentLabel, "");
		panel.add(contentField, "span, growx");
		panel.add(attachGiftLabel, "");
		panel.add(attachGift, "");
		panel.add(typeLabel, "");
		panel.add(typeList);
		panel.add(typeDescLabel, "span 2");
		panel.add(idLabel);
		this.idList.setEnabled(false);
//		this.idList.setRenderer(new EquipAndItemRenderer());
		panel.add(idList, "span, grow");
		panel.add(typeIdLabel);
		panel.add(typeIdField, "grow");
		panel.add(levelLabel);
		this.levelSpinner.setEnabled(false);
		panel.add(levelSpinner, "grow");
		panel.add(countLabel);
		panel.add(countSpinner, "grow");
		panel.add(indateLabel);
		this.indateSpinner.setEnabled(false);
		panel.add(indateSpinner, "grow");
		panel.add(colorLabel, "");
		panel.add(colorList, "grow");
		panel.add(maxStrLabel, "");
		panel.add(maxStrSpinner, "grow");
		panel.add(slotCountLabel, "");
		panel.add(slotCountSpinner, "grow");
		
		panel.add(okButton, "newline, gaptop 40px, span, split 2, align center");
		panel.add(cancelButton);
		
		JXPanel contentPanel = new JXPanel();
		contentPanel.setLayout(new MigLayout("wrap 2, width 100%, height 100%"));
		contentPanel.add(panel, "width 60%, height 100%, grow");
		contentPanel.add(weaponPanel, "width 40%, height 100%, grow");
		
		getContentPane().add(contentPanel);
	}