How to resolve the algorithm Hello world/Graphical step by step in the NetRexx programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Hello world/Graphical step by step in the NetRexx programming language

Table of Contents

Problem Statement

Display the string       Goodbye, World!       on a GUI object   (alert box, plain window, text area, etc.).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Hello world/Graphical step by step in the NetRexx programming language

Source code in the netrexx programming language

/* NetRexx */
options replace format comments java crossref symbols binary

import javax.swing.

msgText = 'Goodbye, World!'
JOptionPane.showMessageDialog(null, msgText)

/* NetRexx */
options replace format comments java crossref symbols binary

import javax.swing.

msgText = 'Goodbye, World!'

window = JFrame(msgText)
text = JTextArea()
minSize = Dimension(200, 100)

text.setText(msgText)

window.setLayout(FlowLayout())
window.add(text)
window.setMinimumSize(minSize)
window.pack
window.setVisible(isTrue)
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

return

method isTrue() public static returns boolean
  return 1 == 1

method isFalse() public static returns boolean
  return \isTrue

/* NetRexx */
options replace format comments java crossref symbols binary

class RCHelloWorld_GraphicalAWT_01 extends Dialog implements ActionListener

  properties private constant
    msgText = 'Goodbye, World!'

  properties indirect
    ok = boolean
    can = boolean
    okButton = Button
    canButton = Button
    buttonPanel = Panel

method RCHelloWorld_GraphicalAWT_01(frame = Frame, msg = String, canaction = boolean) public
  super(frame, 'Default', isTrue)
  setLayout(BorderLayout())
  add(BorderLayout.CENTER, Label(msg))
  addOKCancelPanel(canaction)
  createFrame()
  pack()
  setVisible(isTrue)
  
  return

method RCHelloWorld_GraphicalAWT_01(frame = Frame, msg = String) public
  this(frame, msg, isFalse)
  return

method addOKCancelPanel(canaction = boolean)
  setButtonPanel(Panel())
  getButtonPanel.setLayout(FlowLayout())
  createOKButton()
  if canaction then do
    createCancelButton()
    end
  add(BorderLayout.SOUTH, getButtonPanel)
  return

method createOKButton()
  setOkButton(Button('OK'))
  getButtonPanel.add(getOkButton)
  getOkButton.addActionListener(this)
  return

method createCancelButton()
  setCanButton(Button('Cancel'))
  getButtonPanel.add(getCanButton)
  getCanButton.addActionListener(this)
  return

method createFrame()
  dim = getToolkit().getScreenSize
  setLocation(int(dim.width / 3), int(dim.height / 3))
  return

method actionPerformed(ae = ActionEvent) public
  if ae.getSource == getOkButton then do
    setOk(isTrue)
    setCan(isFalse)
    setVisible(isFalse)
    end
  else if ae.getSource == getCanButton then do
    setCan(isTrue)
    setOk(isFalse)
    setVisible(isFalse)
    end
  return

method main(args = String[]) public constant
  mainFrame = Frame()
  mainFrame.setSize(200, 200)
  mainFrame.setVisible(isTrue)
  message = RCHelloWorld_GraphicalAWT_01(mainFrame, msgText, isTrue)
  if message.isOk then
    say 'OK pressed'
  if message.isCan then
    say 'Cancel pressed'
  message.dispose
  mainFrame.dispose
  return

method isTrue() public static returns boolean
  return 1 == 1

method isFalse() public static returns boolean
  return \isTrue

  

You may also check:How to resolve the algorithm Object serialization step by step in the Rust programming language
You may also check:How to resolve the algorithm Reverse words in a string step by step in the Elena programming language
You may also check:How to resolve the algorithm Find the last Sunday of each month step by step in the Frink programming language
You may also check:How to resolve the algorithm Word wrap step by step in the J programming language
You may also check:How to resolve the algorithm Anagrams/Deranged anagrams step by step in the Elixir programming language