There are 11 code examples for java.awt.Dialog.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: BoardEditor.java (Click to view .java file)
Method Code:
/**
* Sets if the map is visible or not.
* @param visible true if the map should be visible, false if not.
*/
public void setMapVisible(final boolean visible){
minimapW.setVisible(visible);
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: MiniMap.java (Click to view .java file)
Method Code:
void processMouseClick(int x,int y,MouseEvent me){
if (y > (getSize().height - 14)) {
if (x < 14) {
if (zoom == 0) return;
zoom--;
initializeMap();
}
else if (x < 28 && zoom > 2) {
heightDisplayMode=((++heightDisplayMode) > NBR_MODES) ? 0 : heightDisplayMode;
initializeMap();
}
else if (x > (getSize().width - 14)) {
if (zoom == (hexSide.length - 1)) return;
zoom++;
initializeMap();
}
else {
if (minimized) {
setSize(getSize().width,heightBufer);
m_mapImage=createImage(getSize().width,heightBufer);
}
else {
heightBufer=getSize().height;
setSize(getSize().width,14);
m_mapImage=createImage(Math.max(1,getSize().width),14);
}
minimized=!minimized;
m_dialog.pack();
drawMap();
}
}
else {
if ((x < margin) || (x > (getSize().width - leftMargin)) || (y < topMargin)|| (y > (getSize().height - topMargin - 14))) {
return;
}
if ((me.getModifiers() & InputEvent.CTRL_MASK) != 0) {
m_bview.checkLOS(translateCoords(x - leftMargin,y - topMargin));
}
else {
m_bview.centerOnHex(translateCoords(x - leftMargin,y - topMargin));
}
}
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: ChatLounge.java (Click to view .java file)
Method Code:
/**
* Pop up the view mech dialog
*/
public void mechReadout(){
if (lisEntities.getSelectedIndex() == -1) {
return;
}
Entity entity=client.game.getEntity(entityCorrespondance[lisEntities.getSelectedIndex()]);
MechView mechView=new MechView(entity,client.game.getOptions().booleanOption("show_bay_detail"));
TextArea ta=new TextArea();
ta.setEditable(false);
ta.setFont(new Font("Monospaced",Font.PLAIN,12));
ta.setText(mechView.getMechReadout());
final Dialog dialog=new Dialog(clientgui.frame,Messages.getString("ChatLounge.quickView"),false);
Button btn=new Button(Messages.getString("Okay"));
dialog.add("South",btn);
btn.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed( ActionEvent e){
dialog.setVisible(false);
}
}
);
dialog.addWindowListener(new java.awt.event.WindowAdapter(){
@Override public void windowClosing( WindowEvent e){
dialog.setVisible(false);
}
}
);
dialog.add("Center",ta);
BufferedPanel panPreview=new BufferedPanel();
panPreview.setPreferredSize(84,72);
clientgui.loadPreviewImage(panPreview,entity);
dialog.add("North",panPreview);
dialog.setLocationRelativeTo(clientgui.frame);
dialog.setSize(300,450);
dialog.validate();
dialog.setVisible(true);
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: ClientGUI.java (Click to view .java file)
Method Code:
@Override public void gamePhaseChange(GamePhaseChangeEvent e){
if (bv.getLocalPlayer() == null) {
bv.setLocalPlayer(client.getLocalPlayer());
}
switchPanel(client.game.getPhase());
bv.hideTooltip();
switch (e.getNewPhase()) {
case PHASE_LOUNGE:
ReportDisplay rD=(ReportDisplay)phaseComponents.get(String.valueOf(IGame.Phase.PHASE_INITIATIVE_REPORT));
if (rD != null) {
rD.resetTabs();
}
getBoardView().getTilesetManager().reset();
break;
case PHASE_DEPLOY_MINEFIELDS:
case PHASE_DEPLOYMENT:
case PHASE_TARGETING:
case PHASE_MOVEMENT:
case PHASE_OFFBOARD:
case PHASE_FIRING:
case PHASE_PHYSICAL:
if (GUIPreferences.getInstance().getMinimapEnabled() && !minimapW.isVisible()) {
setMapVisible(true);
}
break;
case PHASE_INITIATIVE_REPORT:
case PHASE_TARGETING_REPORT:
case PHASE_MOVEMENT_REPORT:
case PHASE_OFFBOARD_REPORT:
case PHASE_FIRING_REPORT:
case PHASE_END:
case PHASE_VICTORY:
setMapVisible(false);
mechW.setVisible(false);
break;
default :
break;
}
menuBar.setPhase(client.game.getPhase());
cb.getComponent().setVisible(true);
validate();
doLayout();
cb.moveToEnd();
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: MechDisplay.java (Click to view .java file)
Method Code:
/**
* Displays the specified entity in the panel.
*/
public void displayEntity(Entity en){
String enName=en.getShortName();
switch (en.getDamageLevel()) {
case Entity.DMG_CRIPPLED:
enName+=" [CRIPPLED]";
break;
case Entity.DMG_HEAVY:
enName+=" [HEAVY DMG]";
break;
case Entity.DMG_MODERATE:
enName+=" [MODERATE DMG]";
break;
case Entity.DMG_LIGHT:
enName+=" [LIGHT DMG]";
break;
default :
enName+=" [UNDAMAGED]";
}
clientgui.mechW.setTitle(enName);
currentlyDisplaying=en;
mPan.displayMech(en);
aPan.displayMech(en);
wPan.displayMech(en);
sPan.displayMech(en);
ePan.displayMech(en);
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: MapPreview.java (Click to view .java file)
Method Code:
void processMouseClick(int x,int y,MouseEvent me){
if (y > (getSize().height - 14)) {
if (x < 14) {
if (zoom == 0) return;
zoom--;
initializeMap();
}
else if (x < 28 && zoom > 2) {
heightDisplayMode=((++heightDisplayMode) > NBR_MODES) ? 0 : heightDisplayMode;
initializeMap();
}
else if (x > (getSize().width - 14)) {
if (zoom == (hexSide.length - 1)) return;
zoom++;
initializeMap();
}
else {
if (minimized) {
setSize(getSize().width,heightBufer);
m_mapImage=createImage(getSize().width,heightBufer);
}
else {
heightBufer=getSize().height;
setSize(getSize().width,14);
m_mapImage=createImage(Math.max(1,getSize().width),14);
}
minimized=!minimized;
m_dialog.pack();
drawMap();
}
}
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: BoardSelectionDialog.java (Click to view .java file)
Method Code:
public void actionPerformed(ActionEvent e){
if ((e.getSource() == butChange) || (e.getSource() == lisBoardsAvailable)) {
if (lisBoardsAvailable.getSelectedIndex() != -1) {
change(lisBoardsAvailable.getSelectedItem());
}
}
else if (e.getSource() == butUpdate) {
apply();
}
else if (e.getSource() == butOkay) {
send();
}
else if (e.getSource() == butCancel) {
setVisible(false);
mapPreviewW.setVisible(false);
}
else if (e.getSource() == butRandomMap) {
randomMapDialog.setVisible(true);
}
else if (e.getSource() == butPreview) {
previewBoard();
}
else {
try {
int board=Integer.parseInt(e.getActionCommand());
lisBoardsSelected.select(board);
}
catch ( NumberFormatException n) {
}
catch ( ArrayIndexOutOfBoundsException a) {
}
}
}
Project Name: weka Package: weka.gui
Source Code: PropertyDialog.java (Click to view .java file)
Method Code:
/**
* Tries to determine the dialog this panel is part of.
* @param c the container to start with
* @return the parent dialog if one exists or null if not
*/
public static Dialog getParentDialog(Container c){
Dialog result;
Container parent;
result=null;
parent=c;
while (parent != null) {
if (parent instanceof Dialog) {
result=(Dialog)parent;
break;
}
else {
parent=parent.getParent();
}
}
return result;
}
Project Name: weka Package: weka.gui
Source Code: FileEditor.java (Click to view .java file)
Method Code:
/**
* Closes the dialog.
*/
protected void closeDialog(){
if (m_FileChooser instanceof Container) {
Dialog dlg=PropertyDialog.getParentDialog((Container)m_FileChooser);
if (dlg != null) dlg.setVisible(false);
}
}
Project Name: weka Package: weka.gui
Source Code: PropertySheetPanel.java (Click to view .java file)
Method Code:
/**
* default constructor.
* @param owner the owning dialog
*/
public CapabilitiesHelpDialog(Dialog owner){
super(owner);
initialize();
}
Project Name: weka Package: weka.gui.scripting
Source Code: FileScriptingPanel.java (Click to view .java file)
Method Code:
/**
* Fired when action got executed.
* @param e the event
*/
public void actionPerformed(ActionEvent e){
Dialog dialog;
Frame frame;
JFrame jframe;
JInternalFrame jintframe;
int i;
WindowListener[] listeners;
WindowEvent event;
if (!checkModified()) return;
if (PropertyDialog.getParentDialog(FileScriptingPanel.this) != null) {
dialog=PropertyDialog.getParentDialog(FileScriptingPanel.this);
dialog.setVisible(false);
}
else if (PropertyDialog.getParentFrame(FileScriptingPanel.this) != null) {
jintframe=PropertyDialog.getParentInternalFrame(FileScriptingPanel.this);
if (jintframe != null) {
jintframe.doDefaultCloseAction();
}
else {
frame=PropertyDialog.getParentFrame(FileScriptingPanel.this);
if (frame instanceof JFrame) {
jframe=(JFrame)frame;
if (jframe.getDefaultCloseOperation() == JFrame.HIDE_ON_CLOSE) jframe.setVisible(false);
else if (jframe.getDefaultCloseOperation() == JFrame.DISPOSE_ON_CLOSE) jframe.dispose();
else if (jframe.getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE) System.exit(0);
listeners=jframe.getWindowListeners();
event=new WindowEvent(jframe,WindowEvent.WINDOW_CLOSED);
for (i=0; i < listeners.length; i++) listeners[i].windowClosed(event);
}
else {
frame.dispose();
}
}
}
}