Class: SmarterMeter::Interfaces::SettingsWindow
- Inherits:
-
Object
- Object
- SmarterMeter::Interfaces::SettingsWindow
- Defined in:
- lib/smartermeter/interfaces/swing.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ SettingsWindow
constructor
A new instance of SettingsWindow.
Constructor Details
#initialize(&block) ⇒ SettingsWindow
Returns a new instance of SettingsWindow.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/smartermeter/interfaces/swing.rb', line 73 def initialize(&block) UIManager.set_look_and_feel(UIManager.get_system_look_and_feel_class_name) layout = " [ username_label | (150)username_field ] [ password_label | (150)password_field ] [ _ | >save_button ] " @ui = Profligacy::Swing::LEL.new(JFrame, layout) do |c,i| c.username_label = JLabel.new "PG&E Username:" c.username_field = JTextField.new c.password_label = JLabel.new "PG&E Password:" c.password_field = JPasswordField.new c. = JButton.new("Save") i. = { :action => proc do |t, e| config = { :username => @ui.username_field.text, :password => @ui.password_field.text } @frame.dispose yield config end } end @frame = @ui.build(:args => "SmarterMeter Settings") @frame.set_location_relative_to(nil) @frame.default_close_operation = JFrame::DISPOSE_ON_CLOSE end |