0

So I am trying to make a quick way to create java awt projects, and I keep having an error and it doesn't run

This is in my .bash_profile

source $1
if ( "$addButton" not = $NULL ) then
echo 'import java.awt.*;
class window extends Frame {
window(){
    Button b=new Button("'${addButton[4]}'");
    b.setBounds('${addButton[0]}','${addButton[1]}','${addButton[2]}','${addButton[3]}');
add(b);
setSize('$width','$height');
setLayout(null);
setVisible(true);
}
public static void main(String args[]){
window f=new window();
}}' > window.java
fi
if ( "$blank" = "true" ) then 
  echo 'import java.awt.*;
class window extends Frame {
window(){
setSize('$width','$height');
setLayout(null);
setVisible(true);
}
public static void main(String args[]){
window f=new window();
}}' > window.java
fi
javac window.java
java window.java
rm -rf button.sh
rm -rf window.class
rm -rf window.java
}
source Window.sh

This is the Window.sh file

Im trying to make the last line into a runnable arrary cause I cant make objects and I didnt want to make tons of variables for a supper simpe task

height="500"
addButton=( "10" "40" "200" "40" "Hello, World")```
Ronan Leonard
  • 322
  • 3
  • 8
  • You want to make customized GUI windows from a script? Have you considered using an existing tool like zenity? – that other guy May 06 '19 at 22:51
  • Not really I wanted to make something I can easily create java AWT with – Ronan Leonard May 07 '19 at 22:09
  • Ok... [How to compare strings in Bash](https://stackoverflow.com/questions/2237080/how-to-compare-strings-in-bash) is a good start, since `if ( "$addButton" not = $NULL ) then` and `if ( "$blank" = "true" ) then` is not valid syntax – that other guy May 07 '19 at 22:13

0 Answers0