Customized Message Box - Vision

Yes, but you will have to add a JPanel to the dialog box. Here is an example using your custom method:

def disposeDialog(self):
	"""
	Arguments:
		self: A reference to the component instance this method is invoked on. This argument
		  is automatic and should not be specified when invoking this method.
	"""
	def disposeDialog():
		def closeWindow():
			from javax.swing import SwingUtilities
			parent = self
			parent = SwingUtilities.getRoot(parent)
			getWindows = parent.getWindows()
			for disposableWindow in getWindows:
				try:
					if disposableWindow.title == "Options":
						disposableWindow.setVisible(False)
				except:
					pass
		system.util.invokeLater(closeWindow,3000)
		from javax.swing import JOptionPane
		from javax.swing import JPanel
		from javax.swing import JLabel
		from java.awt import Dimension
		from java.awt import BorderLayout
		from java.awt import Color
		from java.awt import Font
		text = JLabel("Problem message", JLabel.CENTER)
		text.setForeground(Color.white)
		text.setFont(Font("Serif", Font.BOLD, 48))
		panel = JPanel()
		panel.setPreferredSize(Dimension(500,500))
		panel.setLayout(BorderLayout())
		panel.add(text,BorderLayout.CENTER)
		panel.setBackground(Color.black)
		pane = JOptionPane
		pane.showOptionDialog(None, panel, "Options", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, None, [], "")				
	system.util.invokeAsynchronous(disposeDialog)

The proceeding code produces the following result:

1 Like