本文整理汇总了Java中javax.swing.JOptionPane.showMessageDialog方法的典型用法代码示例。如果您正苦于以下问题:Java JOptionPane.showMessageDialog方法的具体用法?Java JOptionPane.showMessageDialog怎么用?Java JOptionPane.showMessageDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JOptionPane
的用法示例。
在下文中一共展示了JOptionPane.showMessageDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: btn_ekleActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void btn_ekleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ekleActionPerformed
// TODO add your handling code here:
if (tbl_kisiliste.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(rootPane, "Bir kullanıcı Seçmelisiniz");
return;
}
String kullaniciadi = dtm1.getValueAt(tbl_kisiliste.getSelectedRow(), 0).toString();
for (USER user : USER.Kullanicilar) {
if (user.KullaniciAdi.compareTo(kullaniciadi) == 0) {
user.ArkadaslikIstekleri.add(Frm_Login.loginuser);
break;
}
}
}
示例2: buttonStopTestCOMActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void buttonStopTestCOMActionPerformed(
java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopTestCOMActionPerformed
buttonTestCOM.setEnabled(true);
buttonStopTestCOM.setEnabled(false);
panelDev.setEnabled(false);
buttonSendSignal.setEnabled(false);
buttonChangeAdress.setEnabled(false);
buttonTestDev.setEnabled(false);
if (port != null) {
try {
port.free();
} catch (Exception ex) {
System.err.println(ex);
textDebug.setText("Порт не закрылся. " + ex);
JOptionPane.showMessageDialog(this,
"Порт не закрылся. " + ex,
"Отсыл",
JOptionPane.ERROR_MESSAGE);
throw new RuntimeException(ex);
}
}
textDebug.setText("... Порт закрылся\n" + textDebug.getText());
}
示例3: setFormData2Global
import javax.swing.JOptionPane; //导入方法依赖的package包/类
/**
* Writes the form data to the properties file.
*/
private void setFormData2Global() {
String logBasePath = this.getJTextLoggingBasePath().getText();
if (logBasePath==null || (logBasePath!=null && logBasePath.trim().equals(""))) {
Application.getGlobalInfo().setLoggingBasePath(null);
} else {
// --- Check the settings -------------------------------
String notValidMessage = this.isValidDestinationDirectory(logBasePath);
if (notValidMessage!=null) {
// --- Error with the current settings --------------
String title = Language.translate("Log-Datei Konfiguration");
JOptionPane.showMessageDialog(this, notValidMessage, title, JOptionPane.ERROR_MESSAGE);
return;
}
Application.getGlobalInfo().setLoggingBasePath(logBasePath.trim());
}
Application.getGlobalInfo().setLoggingEnabled(this.getJCheckBoxLoggingEnabled().isSelected());
}
示例4: btn_CadastrarActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void btn_CadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CadastrarActionPerformed
// TODO add your handling code here:
String login = jtf_login.getText();
String senha = jtf_senha.getText();
String nome = jtf_Nome.getText();
String rg = jtf_RG.getText();
String cpf = jtf_CPF.getText();
String telefone = jtf_Telefone.getText();
String email = jtf_Email.getText();
String endereco = jtf_Endereco.getText();
String cartMotorista = jtf_CartMotorista.getText();
if(NegocioFacade.checaCadastro(login, senha, nome, rg, cpf, endereco, cartMotorista, telefone, email)){
NegocioFacade.registrarUsuario(new EDA.Usuario(login, senha, nome, rg, cpf, endereco, cartMotorista, telefone, email, new Comentario("")));
JOptionPane.showMessageDialog(this, "Cadastro efetuado com sucesso!", "Cadastrado!", JOptionPane.INFORMATION_MESSAGE);
this.dispose();
} else {
JOptionPane.showMessageDialog(this, NegocioFacade.getStatus().getErro(), "Erro!", JOptionPane.ERROR_MESSAGE);
}
}
示例5: helpJButtonActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void helpJButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpJButtonActionPerformed
{//GEN-HEADEREND:event_helpJButtonActionPerformed
String helpText =
"INSTRUCTIONS: \n" +
"Welcome to Blackjack(also known as 21)! The main objective of\n" +
"this game is to get the closest to the number 21 without going\n" +
"over. The player will be given two cards at the start of the\n" +
"game. In addition, the dealer will also be given two cards.\n" +
"The player will only know the dealer's first card. From this, \n" +
"the player can get another card or stay with the cards they have.\n" +
"All cards are worth their numeric value, with royals being worth\n" +
"10 points, and ace being 1 or 11 depending on the situation.\n" +
"Whoever has the closest total to 21 at the end wins the game!\n" +
"Good Luck and Remember to have fun!\n";
JOptionPane.showMessageDialog(rootPane, helpText);
}
示例6: abortEvent
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void abortEvent(EventFinishAbort e) {
JWatWizard wizard = (JWatWizard) ((WizardPanel) tabbedPane.getComponentAt(currentPanel)).getParentWizard();
JOptionPane.showMessageDialog(tabbedPane.getComponentAt(currentPanel), e.getMessage(), "LOADING ABORTED!!", JOptionPane.WARNING_MESSAGE);
((InputPanel) tabbedPane.getComponentAt(JWATConstants.WORKLOAD_INPUT_PANEL)).setCanGoForward(false);
wizard.setEnableButton("Next >", false);
wizard.setEnableButton("Solve", false);
}
示例7: RegisterAuszugGUI
import javax.swing.JOptionPane; //导入方法依赖的package包/类
public RegisterAuszugGUI(int regNr, int zuNr) {
try {
initComponents();
this.regNr = regNr;
this.zuNr = zuNr;
it = new InfoTable(regNr, zuNr);
tb_info.setModel(it);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Error: ZuNr oder RegNr falsch.");
System.exit(1);
}
}
示例8: aboutMenuItemActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
Font font = new JLabel().getFont();
// Load HTML and set style to match the application's style
String html
= Translations.get(
"RaceFrame.help.about",
font.getFamily(),
(font.isBold() ? "bold" : "normal"),
"" + font.getSize() + "pt");
// Create HTML content pane
JEditorPane ep = new JEditorPane("text/html", html);
// Handle link clicks
ep.addHyperlinkListener((HyperlinkEvent e) -> {
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
try {
Desktop.getDesktop().browse(e.getURL().toURI());
} catch (IOException | URISyntaxException ex) {
Logger.getLogger(RaceFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
ep.setEditable(false);
ep.setBackground(new JOptionPane().getBackground());
// Show dialog
JOptionPane.showMessageDialog(null, ep);
}
示例9: saveImage2
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void saveImage2(String asciiFN) {
int rows = image.rows;
int cols = image.cols;
int bpp = image.colorDepth;
BufferedImage img = new BufferedImage(cols, rows, BufferedImage.TYPE_INT_RGB);
final int[] buff = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
try {
int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
for (int j = 0; j < cols; j++) {
for (int i = 0; i < rows; i++) {
// Color depth check
if (bpp == 16) {
dicomFile.read(buff2);
tempBuff = (((0xff & buff2[1]) << 8) | (0xff & buff2[0]));
} else if (bpp == 8) {
dicomFile.read(buff1);
tempBuff = (0xff & buff1[0]);
} // End of if-else block
if (tempBuff!= 63536) {
if (tempBuff>max) max = tempBuff;
if (tempBuff<min) min = tempBuff;
int c = (254*tempBuff)/2358;
buff[j*rows+i] = (c<<16) + (c<<8) + (c);
}
} // End of for block
} // End of for block
System.out.print("limits : min="+min+" max="+max);
} catch (IOException ioe) {
System.err.println(ioe);
JOptionPane.showMessageDialog(null, ioe, "Exception", JOptionPane.ERROR_MESSAGE);
System.exit(-1);
} // End of try-catch block
try {
File outputfile = new File(asciiFN+".png");
ImageIO.write(img, "png", outputfile);
} catch (IOException e) {
}
}
示例10: actionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
try {
PdfProcessingFactory.setEditorClass(editorClass);
}
catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(parent, ex.getLocalizedMessage(), ex.getClass().getSimpleName(), JOptionPane.ERROR_MESSAGE);
}
}
示例11: actionRemove
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void actionRemove(){
remove = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (tabela.getSelectedRow()==-1){
JOptionPane.showMessageDialog(null, "Selecione o registro a ser apagado","Alerta", JOptionPane.PLAIN_MESSAGE);
return;
}
Object[] options = {"Sim", "Não"};
int n = JOptionPane.showOptionDialog(null, "Deseja realmente apagar o registro: "+tabela.getSelectedRow(), "Alerta", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE, null, options,options[0] );
if (n == 1){
return;
}
EntityManager em = Persistence.createEntityManagerFactory("notaFiscal_unit").createEntityManager();
em.getTransaction().begin();
String j =""+tabela.getValueAt(tabela.getSelectedRow(), 0);
long i = Long.parseLong(j);
Query q = em.createQuery("delete from Nf n "
+ "where n.notaFiscalNumero = :name");
q.setParameter("name", i);
int deleted = q.executeUpdate();
em.getTransaction().commit();
em.close();
model.removeRow(tabela.getSelectedRow());
}
};
}
示例12: jButton1ActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if(e.resultado==parseInt(jTextField1.getText())){
a.puntajeAcumulado=a.puntajeAcumulado + e.puntaje;
a.nivel.numeroNivel = Alumno.calcularNuevoNivel(a.puntajeAcumulado);
try {
ConectarBD con1 = new ConectarBD();
Connection cnUp=null;
cnUp = con1.getCon();
String sql = "UPDATE alumno SET puntajeAcumulado= ?, numeroNivel= ? WHERE usuario= ? AND contrasenia= ? ";
PreparedStatement st = cnUp.prepareStatement(sql);
st.setInt(1, a.puntajeAcumulado);
st.setInt(2, a.nivel.numeroNivel);
st.setString(3, a.usuario);
st.setString(4, a.contrasenia);
st.executeUpdate();
this.setVisible(false);
} catch (SQLException ex) {
Logger.getLogger(HacerEjercicioAlumno.class.getName()).log(Level.SEVERE, null, ex);
}
JOptionPane.showMessageDialog(null, "Correcto!");
} else{
JOptionPane.showMessageDialog(null, "Incorrecto!");
this.setVisible(false);}
}
示例13: actionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
JMenuItem target = (JMenuItem)e.getSource();
String actionCommand = target.getActionCommand();
try {
if (actionCommand.equals("Open")) {
_open();
} else if (actionCommand.equals("Save")) {
_save();
} else if (actionCommand.equals("SaveAs")) {
_saveAs();
} else if (actionCommand.equals("Export")) {
_export();
} else if (actionCommand.equals("Print")) {
_print();
} else if (actionCommand.equals("Close")) {
_close();
}
} catch (Exception exception) {
// If we do not catch exceptions here, then they
// disappear to stdout, which is bad if we launched
// where there is no stdout visible.
JOptionPane.showMessageDialog(null,
"File Menu Exception:\n" + exception.toString(),
"Ptolemy Plot Error", JOptionPane.WARNING_MESSAGE);
}
// NOTE: The following should not be needed, but there jdk1.3beta
// appears to have a bug in swing where repainting doesn't
// properly occur.
repaint();
}
示例14: monSeqOpMode1ActionPerformed
import javax.swing.JOptionPane; //导入方法依赖的package包/类
private void monSeqOpMode1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monSeqOpMode1ActionPerformed
if (aemon instanceof CypressFX2MonitorSequencer) {
CypressFX2MonitorSequencer fx = (CypressFX2MonitorSequencer) aemon;
try {
fx.setOperationMode(1);
JOptionPane.showMessageDialog(this, "Timestamp tick set to " + fx.getOperationMode() + " us. Note that jAER will treat the ticks as 1us anyway.");
} catch (Exception e) {
e.printStackTrace();
aemon.close();
}
}
}
示例15: openXmlPng
import javax.swing.JOptionPane; //导入方法依赖的package包/类
/**
* Reads XML+PNG format.
*/
protected void openXmlPng(BasicGraphEditor editor, File file)
throws IOException
{
Map<String, String> text = mxPngTextDecoder
.decodeCompressedText(new FileInputStream(file));
if (text != null)
{
String value = text.get("mxGraphModel");
if (value != null)
{
Document document = mxXmlUtils.parseXml(URLDecoder.decode(
value, "UTF-8"));
mxCodec codec = new mxCodec(document);
codec.decode(document.getDocumentElement(), editor
.getGraphComponent().getGraph().getModel());
editor.setCurrentFile(file);
resetEditor(editor);
return;
}
}
JOptionPane.showMessageDialog(editor,
mxResources.get("imageContainsNoDiagramData"));
}