Sha256: 28758945e5d8f3bfefdb9579efc5d3146e49a23217536afe0079ea5ff0a3f8d9

Contents?: true

Size: 1006 Bytes

Versions: 5

Compression:

Stored size: 1006 Bytes

Contents

require 'rubygems'
require 'rubeus'

class JTabbedPaneExample
  include Rubeus::Swing

  def initialize
    JFrame.new(:title => 'JTabbedPane Example') do |f|
      tp = JTabbedPane.new(:LEFT, :SCROLL_TAB_LAYOUT) do |tp|
        # tab #1
        JSplitPane.new(:HORIZONTAL_SPLIT) do
          JButton.new("button") do
            javax.swing.JOptionPane.showMessageDialog(f, "button pushed!")
            tp.set_selected_index(1)
          end
          JLabel.new("<- Push this button.")
        end

        # tab #2
        JPanel.new do |p|
          p.layout = BoxLayout.new(:Y_AXIS)
          JLabel.new("Notepad")
          JTextArea.new
        end

        # tab #3
        jl = JLabel.new("This is a JTabbedPane Example.")

        # tab settings
        tp.set_titles(['First tab', 'Second Tab'])
        tp.set_icons(['', '', 'nyanco_viewer/nekobean_s.png'])
        tp.set_tips((1..3).to_a.map { |num| "tip#{num}" })
      end

      f.visible = true
    end
  end
end

JTabbedPaneExample.new

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubeus-0.1.0-java examples/rubeus_swing_example03.rb
rubeus-0.0.9-java examples/rubeus_swing_example03.rb
rubeus-0.0.8-java examples/rubeus_swing_example03.rb
rubeus-0.0.6-java examples/rubeus_swing_example03.rb
rubeus-0.0.7-java examples/rubeus_swing_example03.rb