require “shortcut” require “<%=config%>/version”
import java.awt.Dimension import java.awt.event.KeyEvent import javax.swing.JPanel
<%- config.each_with_index do |c,i| -%> <%= ‘ ’*i %>module <%= c %> <%- end -%> <%= ‘ ’*config.size %>class Application < Shortcut::Window
<%= ‘ ’*config.size %> title <%=config.inspect%> <%= ‘ ’*config.size %> always_on_top true <%= ‘ ’*config.size %> size 440, 250 <%= ‘ ’*config.size %> layout BorderLayout
<%= ‘ ’*config.size %> action ‘some_example_action’ do <%= ‘ ’*config.size %> display_info(“Some example action!”) <%= ‘ ’*config.size %> end
<%= ‘ ’*config.size %> key_pressed KeyEvent::VK_A, ‘some_example_action’
<%= ‘ ’*config.size %> key_pressed KeyEvent::VK_ESCAPE do <%= ‘ ’*config.size %> display_info(“Escape key pressed!”) <%= ‘ ’*config.size %> end
<%= ‘ ’*config.size %> key_pressed KeyEvent::VK_C do <%= ‘ ’*config.size %> display_info(“This will simulate a click at position 100, 200! (uncomment code for it to work)”) <%= ‘ ’*config.size %> # Uncomment the next line for it to work <%= ‘ ’*config.size %> click(100, 200) <%= ‘ ’*config.size %> end
<%= ‘ ’*config.size %> def create_components <%= ‘ ’*config.size %> # JPanel <%= ‘ ’*config.size %> panel = JPanel.new() <%= ‘ ’*config.size %> add(panel, BorderLayout::NORTH)
<%= ‘ ’*config.size %> # Button <%= ‘ ’*config.size %> button = create_button(‘Some example button’, ‘some_example_action’) <%= ‘ ’*config.size %> panel.add(button)
<%= ‘ ’*config.size %> # Feedback text area <%= ‘ ’*config.size %> text_area = feedback_text_area(“Welcome to <%=config%>!”) <%= ‘ ’*config.size %> scroll_pane = feedback_scroll_panel(text_area, Dimension.new(375, 125)) <%= ‘ ’*config.size %> add(scroll_pane, BorderLayout::CENTER) <%= ‘ ’*config.size %> end <%= ‘ ’*config.size %>end <%- (config.size-1).downto(0) do |i| -%> <%= ‘ ’*i %>end <%- end -%>