Class: Glimmer::Swing::ComponentProxy::JFrameProxy

Inherits:
Glimmer::Swing::ComponentProxy show all
Defined in:
lib/glimmer/swing/component_proxy/j_frame_proxy.rb

Overview

Proxy for Swing JFrame objects

Follows the Proxy Design Pattern

Constant Summary collapse

DEFAULT_WIDTH =
190
DEFAULT_HEIGHT =
150

Instance Attribute Summary

Attributes inherited from Glimmer::Swing::ComponentProxy

#args, #block, #keyword, #original, #parent_proxy

Instance Method Summary collapse

Methods inherited from Glimmer::Swing::ComponentProxy

#add_listener, #can_add_listener?, #can_handle_observation_request?, component_class, component_class_manual_entries, component_class_symbol, component_proxy_class, component_proxy_class_symbol, #content, create, exist?, find_listener, flyweight_component_class, #handle_observation_request, #initialize, keyword, listener_class, #method_missing, #post_initialize_child, #respond_to?, #respond_to_original?, #send_to_original, #shape_proxies

Methods included from Packages

included

Constructor Details

This class inherits a constructor from Glimmer::Swing::ComponentProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::Swing::ComponentProxy

Instance Method Details

#post_add_contentObject



44
45
46
47
48
49
50
51
52
# File 'lib/glimmer/swing/component_proxy/j_frame_proxy.rb', line 44

def post_add_content
  unless @initial_content_added
    @initial_content_added = true
    the_width = @minimum_size_set ? minimum_size.width : DEFAULT_WIDTH
    the_height = @minimum_size_set ? minimum_size.height : DEFAULT_HEIGHT
    set_minimum_size(Java::JavaAwt::Dimension.new(the_width, the_height))
    set_default_close_operation(Java::JavaxSwing::JFrame::EXIT_ON_CLOSE)
  end
end

#set_minimum_size(*args) ⇒ Object Also known as: minimum_size=



34
35
36
37
38
39
40
41
# File 'lib/glimmer/swing/component_proxy/j_frame_proxy.rb', line 34

def set_minimum_size(*args)
  @minimum_size_set = true
  if args.size == 1 && args.first.is_a?(Java::JavaAwt::Dimension)
    super
  else
    super(Java::JavaAwt::Dimension.new(*args))
  end
end

#showObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/glimmer/swing/component_proxy/j_frame_proxy.rb', line 54

def show
  unless @shown_at_least_once
    @shown_at_least_once = true
    Java::JavaxSwing::SwingUtilities.invoke_later do
      pack
      set_visible(true)
    end
  else
    set_visible(true)
  end
end