本文整理了Java中javax.swing.JDesktopPane.add()
方法的一些代码示例,展示了JDesktopPane.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDesktopPane.add()
方法的具体详情如下:
包路径:javax.swing.JDesktopPane
类名称:JDesktopPane
方法名:add
暂无
代码示例来源:origin: chewiebug/GCViewer
public void addDocument(GCDocument gcDocument) {
desktopPane.add(gcDocument);
gcDocument.setSize(450, 300);
gcDocument.setVisible(true);
repaint();
try {
gcDocument.setSelected(true);
gcDocument.setMaximum(true);
}
catch (PropertyVetoException e) {
e.printStackTrace();
}
}
代码示例来源:origin: magefree/mage
public void showTableWaitingDialog(UUID roomId, UUID tableId, boolean isTournament) {
TableWaitingDialog tableWaitingDialog = new TableWaitingDialog();
desktopPane.add(tableWaitingDialog, JLayeredPane.MODAL_LAYER);
tableWaitingDialog.showDialog(roomId, tableId, isTournament);
}
代码示例来源:origin: magefree/mage
public void showGameEndDialog(GameEndView gameEndView) {
GameEndDialog gameEndDialog = new GameEndDialog(gameEndView);
desktopPane.add(gameEndDialog, JLayeredPane.MODAL_LAYER);
gameEndDialog.showDialog();
}
代码示例来源:origin: magefree/mage
public void showUserRequestDialog(final UserRequestMessage userRequestMessage) {
final UserRequestDialog userRequestDialog = new UserRequestDialog();
userRequestDialog.setLocation(100, 100);
desktopPane.add(userRequestDialog, JLayeredPane.MODAL_LAYER);
if (SwingUtilities.isEventDispatchThread()) {
userRequestDialog.showDialog(userRequestMessage);
} else {
SwingUtilities.invokeLater(() -> userRequestDialog.showDialog(userRequestMessage));
}
}
代码示例来源:origin: magefree/mage
/**
* Creates new form ConnectDialog
*/
public ConnectDialog() {
initComponents();
this.txtServer.addActionListener(connectAction);
this.txtPort.addActionListener(connectAction);
this.txtUserName.addActionListener(connectAction);
this.txtPassword.addActionListener(connectAction);
registerUserDialog = new RegisterUserDialog(this);
MageFrame.getDesktop().add(registerUserDialog, JLayeredPane.MODAL_LAYER);
resetPasswordDialog = new ResetPasswordDialog(this);
MageFrame.getDesktop().add(resetPasswordDialog, JLayeredPane.MODAL_LAYER);
}
代码示例来源:origin: magefree/mage
private void setBackground() {
if (liteMode || grayMode) {
return;
}
String filename = "/background.jpg";
try {
if (Plugins.instance.isThemePluginLoaded()) {
backgroundPane = (ImagePanel) Plugins.instance.updateTablePanel(new HashMap<>());
} else {
InputStream is = this.getClass().getResourceAsStream(filename);
BufferedImage background = ImageIO.read(is);
backgroundPane = new ImagePanel(background, ImagePanelStyle.SCALED);
}
backgroundPane.setSize(1024, 768);
desktopPane.add(backgroundPane, JLayeredPane.DEFAULT_LAYER);
} catch (IOException e) {
LOGGER.fatal("Error while setting background.", e);
}
}
代码示例来源:origin: magefree/mage
public static void main(String args[]) {
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JDesktopPane desktopPane = new JDesktopPane();
DesktopManager dm = new MageDesktopManager();
desktopPane.setDesktopManager(dm);
JInternalFrame internalFrame = new JInternalFrame("Test Internal Frame", true, false, true, true);
internalFrame.setSize(200, 150);
internalFrame.setVisible(true);
desktopPane.add(internalFrame);
frame.add(desktopPane, BorderLayout.CENTER);
frame.setSize(800, 600);
frame.setVisible(true);
});
}
}
代码示例来源:origin: magefree/mage
public void openGraveyardWindow(String playerName) {
if (graveyardWindows.containsKey(playerName)) {
CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(playerName);
if (cardInfoWindowDialog.isVisible()) {
cardInfoWindowDialog.hideDialog();
} else {
cardInfoWindowDialog.show();
}
return;
}
CardInfoWindowDialog newGraveyard = new CardInfoWindowDialog(ShowType.GRAVEYARD, playerName);
graveyardWindows.put(playerName, newGraveyard);
MageFrame.getDesktop().add(newGraveyard, JLayeredPane.PALETTE_LAYER);
newGraveyard.loadCards(graveyards.get(playerName), bigCard, gameId, false);
}
代码示例来源:origin: magefree/mage
public void btnAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutActionPerformed
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.MODAL_LAYER);
for (JInternalFrame window : windows) {
if (window instanceof AboutDialog) {
// don't open the window twice.
return;
}
}
AboutDialog aboutDialog = new AboutDialog();
desktopPane.add(aboutDialog, JLayeredPane.MODAL_LAYER);
aboutDialog.showDialog(VERSION);
}//GEN-LAST:event_btnAboutActionPerformed
代码示例来源:origin: magefree/mage
private void handleGameInfoWindow(Map<String, CardInfoWindowDialog> windowMap, ShowType showType, String name, LinkedHashMap cardsView) {
CardInfoWindowDialog cardInfoWindowDialog;
if (!windowMap.containsKey(name)) {
cardInfoWindowDialog = new CardInfoWindowDialog(showType, name);
windowMap.put(name, cardInfoWindowDialog);
MageFrame.getDesktop().add(cardInfoWindowDialog, JLayeredPane.PALETTE_LAYER);
} else {
cardInfoWindowDialog = windowMap.get(name);
}
if (cardInfoWindowDialog != null && !cardInfoWindowDialog.isClosed()) {
switch (showType) {
case REVEAL:
case REVEAL_TOP_LIBRARY:
cardInfoWindowDialog.loadCards((CardsView) cardsView, bigCard, gameId);
break;
case LOOKED_AT:
cardInfoWindowDialog.loadCards((SimpleCardsView) cardsView, bigCard, gameId);
break;
}
}
}
代码示例来源:origin: magefree/mage
public void replayGame(UUID gameId) {
GamePane gamePane = new GamePane();
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
gamePane.setVisible(true);
gamePane.replayGame(gameId);
setActive(gamePane);
}
代码示例来源:origin: magefree/mage
public void showDraft(UUID draftId) {
DraftPane draftPane = new DraftPane();
desktopPane.add(draftPane, JLayeredPane.DEFAULT_LAYER);
draftPane.setVisible(true);
draftPane.showDraft(draftId);
setActive(draftPane);
}
代码示例来源:origin: magefree/mage
public void showDialog(MageDialogState mageDialogState) {
showDownloadControls(false); // call to change window size
// window settings
if (this.isModal()) {
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
} else {
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
}
if (mageDialogState != null) {
mageDialogState.setStateToDialog(this);
} else {
this.makeWindowCentered();
}
this.setVisible(true);
}
代码示例来源:origin: magefree/mage
/**
* Shows a game for a player of the game
*
* @param gameId
* @param playerId
*/
public void showGame(UUID gameId, UUID playerId) {
GamePane gamePane = new GamePane();
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
gamePane.setVisible(true);
gamePane.showGame(gameId, playerId);
setActive(gamePane);
}
代码示例来源:origin: magefree/mage
public void showCollectionViewer() {
Component[] windows = desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
for (Component window : windows) {
if (window instanceof CollectionViewerPane) {
setActive((MagePane) window);
return;
}
}
CollectionViewerPane collectionViewerPane = new CollectionViewerPane();
desktopPane.add(collectionViewerPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
collectionViewerPane.setVisible(true);
setActive(collectionViewerPane);
}
代码示例来源:origin: magefree/mage
public void watchGame(UUID gameId) {
for (Component component : desktopPane.getComponents()) {
if (component instanceof GamePane
&& ((GamePane) component).getGameId().equals(gameId)) {
setActive((GamePane) component);
return;
}
}
GamePane gamePane = new GamePane();
desktopPane.add(gamePane, JLayeredPane.DEFAULT_LAYER);
gamePane.setVisible(true);
gamePane.watchGame(gameId);
setActive(gamePane);
}
代码示例来源:origin: magefree/mage
public void showTournament(UUID tournamentId) {
for (Component component : desktopPane.getComponents()) {
if (component instanceof TournamentPane
&& ((TournamentPane) component).getTournamentId().equals(tournamentId)) {
setActive((TournamentPane) component);
return;
}
}
TournamentPane tournamentPane = new TournamentPane();
desktopPane.add(tournamentPane, JLayeredPane.DEFAULT_LAYER);
tournamentPane.setVisible(true);
tournamentPane.showTournament(tournamentId);
setActive(tournamentPane);
}
代码示例来源:origin: magefree/mage
public void loadCards(String name, CardsView pile1, CardsView pile2, BigCard bigCard, UUID gameId) {
this.title = name;
this.pile1.loadCardsNarrow(pile1, bigCard, gameId);
this.pile2.loadCardsNarrow(pile2, bigCard, gameId);
if (getParent() != MageFrame.getDesktop() /*|| this.isClosed*/) {
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
}
pack();
this.makeWindowCentered();
this.revalidate();
this.repaint();
this.setModal(true);
// window settings
if (this.isModal()) {
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
} else {
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
}
this.setVisible(true);
}
代码示例来源:origin: magefree/mage
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
String name;
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING || mode == DeckEditorMode.VIEW_LIMITED_DECK) {
name = "Deck Editor - " + tableId.toString();
} else {
if (deck != null) {
name = "Deck Editor - " + deck.getName();
} else {
name = "Deck Editor";
}
// use already open editor
Component[] windows = desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER);
for (Component window : windows) {
if (window instanceof DeckEditorPane && ((MagePane) window).getTitle().equals(name)) {
setActive((MagePane) window);
return;
}
}
}
DeckEditorPane deckEditorPane = new DeckEditorPane();
desktopPane.add(deckEditorPane, JLayeredPane.DEFAULT_LAYER);
deckEditorPane.setVisible(false);
deckEditorPane.show(mode, deck, name, tableId, time);
setActive(deckEditorPane);
}
代码示例来源:origin: magefree/mage
MageFrame.getDesktop().add(newTableDialog, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(newTournamentDialog, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(joinTableDialog, JLayeredPane.MODAL_LAYER);
内容来源于网络,如有侵权,请联系作者删除!