示例#1
0
 def __init__( self, c ):
     self.c = c
     self.browser = browser.WebBrowser()
     self.base = swing.JPanel( java.awt.BorderLayout() )
     self.base.add( self.browser )
     bf = swing.JToolBar()
     path = g.os_path_join( g.app.loadDir,"..","Icons/webbrowser", "left.png" )
     ii = swing.ImageIcon( path )
     self.bbutton = back = swing.JButton( ii )
     back.setText( "Back" )
     back.setHorizontalTextPosition( swing.SwingConstants.CENTER )
     back.setVerticalTextPosition( swing.SwingConstants.BOTTOM )
     back.actionPerformed = lambda event : self.back()
     bf.add( back )
     path = g.os_path_join( g.app.loadDir,"..","Icons/webbrowser", "right.png" )
     ii = swing.ImageIcon( path )
     self.fbutton = forward = swing.JButton( ii )
     forward.setText( "Forward" )
     forward.setHorizontalTextPosition( swing.SwingConstants.CENTER )
     forward.setVerticalTextPosition( swing.SwingConstants.BOTTOM )
     forward.actionPerformed = lambda event: self.forward()
     bf.add( forward )
     path = g.os_path_join( g.app.loadDir,"..","Icons/webbrowser", "reload.png" )
     ii = swing.ImageIcon( path )
     refresh = swing.JButton( ii )
     refresh.setText( "Reload" )
     refresh.setHorizontalTextPosition( swing.SwingConstants.CENTER )
     refresh.setVerticalTextPosition( swing.SwingConstants.BOTTOM )
     refresh.actionPerformed = lambda event: self.browser.refresh()
     bf.add( refresh )
     self.base.add( bf, java.awt.BorderLayout.NORTH )
     jp2 = swing.JPanel( java.awt.BorderLayout())
     self.jtf = swing.JTextField()
     CutCopyPaste( self.jtf )
     jp2.add( self.jtf )
     path = g.os_path_join( g.app.loadDir,"..","Icons", "do-it.gif" )
     ii = swing.ImageIcon( path )
     self.jb = swing.JButton( ii )
     self.jb.actionPerformed = self.go
     jp2.add( self.jb, java.awt.BorderLayout.EAST )
     jp3 = swing.JPanel( java.awt.GridLayout( 2, 1 ) )
     jp3.add( jp2 )
     jp4 = swing.JPanel()
     headline = swing.JButton( "Goto Headline" )
     headline.actionPerformed = self.goToHeadline
     jp4.add( headline )
     store = swing.JButton( "Store Page In Node" )
     store.actionPerformed = self.storePage
     jp4.add( store )
     feed = swing.JButton( "Feed Tree To Browser" )
     feed.actionPerformed = self.feedNodesBodyContents
     jp4.add( feed )
     jp3.add( jp4 )
     self.base.add( jp3, java.awt.BorderLayout.SOUTH )
     self.history = []
     self.historypointer = -1
     self.ignore = 0
     self.enableButtons()
     self.browser.addWebBrowserListener( self )
示例#2
0
def classify_image(image):
    """Displays a window that allows the user to view and classify an image."""
    frame = swing.JFrame()
    frame.defaultCloseOperation = swing.JFrame.DO_NOTHING_ON_CLOSE
    frame.add(swing.JLabel(swing.ImageIcon(image)))
    frame.add(swing.JLabel("Enter one of " + ", ".join(CLASS_NAMES)))
    frame.layout = swing.BoxLayout(frame.contentPane, swing.BoxLayout.Y_AXIS)
    class_field = swing.JTextField()
    classify_button = swing.JButton("Classify")
    condition = threading.Condition()

    def listener(_event):
        if class_field.text in CLASS_NAMES:
            with condition:
                condition.notifyAll()
        else:
            swing.JOptionPane.showMessageDialog(
                frame, "Image type is not one of the recognized types",
                "Input error", swing.JOptionPane.ERROR_MESSAGE)

    class_field.addActionListener(listener)
    classify_button.addActionListener(listener)
    frame.add(class_field)
    frame.add(classify_button)
    frame.pack()
    frame.visible = True
    with condition:
        condition.wait()
    frame.dispose()
    return class_field.text
    def run(self):
        self.splash = splash = swing.JWindow()
        splash.setAlwaysOnTop(1)
        cpane = splash.getContentPane()
        rp = splash.getRootPane()
        tb = sborder.TitledBorder("Leo")
        tb.setTitleJustification(tb.CENTER)
        rp.setBorder(tb)
        splash.setBackground(awt.Color.ORANGE)
        dimension = awt.Dimension(400, 400)
        splash.setPreferredSize(dimension)
        splash.setSize(400, 400)

        sicon = g.os_path_join(g.app.loadDir, "..", "Icons", "Leosplash.GIF")
        #ii = swing.ImageIcon( "../Icons/Leosplash.GIF" )
        ii = swing.ImageIcon(sicon)
        image = swing.JLabel(ii)
        image.setBackground(awt.Color.ORANGE)
        cpane.add(image)
        self.splashlabel = splashlabel = swing.JLabel("Leo Starting....")
        splashlabel.setBackground(awt.Color.ORANGE)
        splashlabel.setForeground(awt.Color.BLUE)
        cpane.add(splashlabel, awt.BorderLayout.SOUTH)
        w, h = self._calculateCenteredPosition(splash)
        splash.setLocation(w, h)
        splash.visible = True
    def attachLeoIcon(self, window):
        """Attach the Leo icon to a window."""

        sicon = g.os_path_join(g.app.loadDir, "..", "Icons", "Leoapp.GIF")
        #ii = swing.ImageIcon( "../Icons/Leosplash.GIF" )
        ii = swing.ImageIcon(sicon)
        window.setIconImage(ii.getImage())
示例#5
0
def display(image, title=""):
    """Opens a window displaying the given image (which may be an Image object or the file name of an image).
	Closing the window will not terminate the program."""
    window = swing.JFrame(title)
    window.defaultCloseOperation = swing.JFrame.DISPOSE_ON_CLOSE
    window.add(swing.JLabel(swing.ImageIcon(image)))
    window.pack()
    window.visible = True
示例#6
0
    def __init__(self, debugger):
        self.lastValue = None
        self.debugger = debugger
        MAX_SPEED = debugger.MAX_SPEED
        self.slider = swing.JSlider(swing.JSlider.HORIZONTAL,
                                    0,
                                    MAX_SPEED,
                                    self.debugger.speed,
                                    stateChanged=self.stateChanged)
        self.last_speed = self.debugger.speed
        labels = Hashtable()
        labels.put(0, swing.JLabel('slow'))
        labels.put(MAX_SPEED, swing.JLabel('fast'))
        self.slider.labelTable = labels
        self.slider.paintLabels = 1

        self.addButton = swing.JButton(swing.ImageIcon('images/plus.jpg'),
                                       actionPerformed=self.actionPerformed,
                                       toolTipText='add Variable',
                                       preferredSize=BUTTON_SIZE)
        self.deleteButton = swing.JButton(swing.ImageIcon('images/minus.jpg'),
                                          actionPerformed=self.actionPerformed,
                                          toolTipText='remove Variable',
                                          preferredSize=BUTTON_SIZE)
        self.stepButton = swing.JButton(swing.ImageIcon('images/boot.jpg'),
                                        actionPerformed=self.actionPerformed,
                                        toolTipText='step',
                                        preferredSize=BUTTON_SIZE)
        self.pauseIcon = swing.ImageIcon('images/pause.jpg')
        self.runIcon = swing.ImageIcon('images/run.jpg')
        self.runButton = swing.JButton(self.runIcon,
                                       actionPerformed=self.actionPerformed,
                                       toolTipText='run',
                                       preferredSize=BUTTON_SIZE)
        self.fullspeedButton = swing.JButton(
            swing.ImageIcon('images/fullspeed.jpg'),
            actionPerformed=self.actionPerformed,
            toolTipText='full speed',
            preferredSize=BUTTON_SIZE)
        self.stopButton = swing.JButton(swing.ImageIcon('images/stop.jpg'),
                                        actionPerformed=self.actionPerformed,
                                        toolTipText='stop',
                                        preferredSize=BUTTON_SIZE)
        self.setLayout(swing.BoxLayout(self, swing.BoxLayout.X_AXIS))
        self.add(self.slider)
        self.add(self.addButton)
        self.add(self.deleteButton)
        #self.add(self.stepButton) # These two lines commented out by Brian O because of removed Pause functionality -- 23 June 2008
        #self.add(self.runButton)
        self.add(self.fullspeedButton)
        self.add(self.stopButton)
        self.initialButtonState()
示例#7
0
    def __init__(self, c, jtab, i):
        swing.JPanel.__init__(self)
        self.c = c
        self.createWidgets()
        self.tdata = self.CommentTableModel()
        #self.slist.setModel( self.tdata )
        #self.slist.getSelectionModel().addListSelectionListener( self )
        self.commentarea.getDocument().addDocumentListener(self)
        #print self.slist.getCellEditor()
        #self.slist.getDefaultEditor( java.lang.Object.__class__ ).addCellEditorListener( self )
        import leoPlugins
        leoPlugins.registerHandler("select1", self.nodeSelected)
        self.jtab = jtab
        self.i = i

        self.icon = swing.ImageIcon(
            g.os_path_join(g.app.loadDir, "..", "Icons", "Cloud24.gif"))
示例#8
0
    def __init__(self):
        #########################################################
        #
        # set up the overall frame (the window itself)
        #
        self.window = swing.JFrame("Swing Sampler!")
        self.window.windowClosing = self.goodbye
        self.window.contentPane.layout = awt.BorderLayout()

        #########################################################
        #
        # under this will be a tabbed pane; each tab is named
        # and contains a panel with other stuff in it.
        #
        tabbedPane = swing.JTabbedPane()
        self.window.contentPane.add("Center", tabbedPane)

        #########################################################
        #
        # The first tabbed panel will be named "Some Basic
        # Widgets", and is referenced by variable 'firstTab'
        #
        firstTab = swing.JPanel()
        firstTab.layout = awt.BorderLayout()
        tabbedPane.addTab("Some Basic Widgets", firstTab)

        #
        # slap in some labels, a list, a text field, etc... Some
        # of these are contained in their own panels for
        # layout purposes.
        #
        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.GridLayout(3, 1)
        tmpPanel.border = swing.BorderFactory.createTitledBorder(
            "Labels are simple")
        tmpPanel.add(swing.JLabel("I am a label. I am quite boring."))
        tmpPanel.add(
            swing.JLabel(
                "<HTML><FONT COLOR='blue'>HTML <B>labels</B></FONT> are <I>somewhat</I> <U>less boring</U>.</HTML>"
            ))
        tmpPanel.add(
            swing.JLabel("Labels can also be aligned", swing.JLabel.RIGHT))
        firstTab.add(tmpPanel, "North")

        #
        # Notice that the variable "tmpPanel" gets reused here.
        # This next line creates a new panel, but we reuse the
        # "tmpPanel" name to refer to it.  The panel that
        # tmpPanel used to refer to still exists, but we no
        # longer have a way to name it (but that's ok, since
        # we don't need to refer to it any more).

        #
        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.BorderLayout()
        tmpPanel.border = swing.BorderFactory.createTitledBorder(
            "Tasty tasty lists")

        #
        # Note that here we stash a reference to the list in
        # "self.list".  This puts it in the scope of the object,
        # rather than this function.  This is because we'll be
        # referring to it later from outside this function, so
        # it needs to be "bumped up a level."
        #

        listData = [
            "January", "February", "March", "April", "May", "June", "July",
            "August", "September", "October", "November", "December"
        ]
        self.list = swing.JList(listData)
        tmpPanel.add("Center", swing.JScrollPane(self.list))
        button = swing.JButton("What's Selected?")
        button.actionPerformed = self.whatsSelectedCallback
        tmpPanel.add("East", button)
        firstTab.add("Center", tmpPanel)

        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.BorderLayout()

        #
        # The text field also goes in self, since the callback
        # that displays the contents will need to get at it.
        #
        # Also note that because the callback is a function inside
        # the SwingSampler object, you refer to it through self.
        # (The callback could potentially be outside the object,
        # as a top-level function. In that case you wouldn't
        # use the 'self' selector; any variables that it uses
        # would have to be in the global scope.
        #
        self.field = swing.JTextField()
        tmpPanel.add(self.field)
        tmpPanel.add(
            swing.JButton("Click Me", actionPerformed=self.clickMeCallback),
            "East")
        firstTab.add(tmpPanel, "South")

        #########################################################
        #
        # The second tabbed panel is next...  This shows
        # how to build a basic web browser in about 20 lines.
        #
        secondTab = swing.JPanel()
        secondTab.layout = awt.BorderLayout()
        tabbedPane.addTab("HTML Fanciness", secondTab)

        tmpPanel = swing.JPanel()
        tmpPanel.add(swing.JLabel("Go to:"))
        self.urlField = swing.JTextField(40, actionPerformed=self.goToCallback)
        tmpPanel.add(self.urlField)
        tmpPanel.add(swing.JButton("Go!", actionPerformed=self.goToCallback))
        secondTab.add(tmpPanel, "North")

        self.htmlPane = swing.JEditorPane("http://www.google.com",
                                          editable=0,
                                          hyperlinkUpdate=self.followHyperlink,
                                          preferredSize=(400, 400))
        secondTab.add(swing.JScrollPane(self.htmlPane), "Center")

        self.statusLine = swing.JLabel("(status line)")
        secondTab.add(self.statusLine, "South")

        #########################################################
        #
        # The third tabbed panel is next...
        #
        thirdTab = swing.JPanel()
        tabbedPane.addTab("Other Widgets", thirdTab)

        imageLabel = swing.JLabel(
            swing.ImageIcon(
                net.URL("http://www.gatech.edu/images/logo-gatech.gif")))
        imageLabel.toolTipText = "Labels can have images! Every widget can have a tooltip!"
        thirdTab.add(imageLabel)

        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.GridLayout(3, 2)
        tmpPanel.border = swing.BorderFactory.createTitledBorder(
            "Travel Checklist")
        tmpPanel.add(
            swing.JCheckBox("Umbrella", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Rain coat", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Passport", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Airline tickets",
                            actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("iPod", actionPerformed=self.checkCallback))
        tmpPanel.add(
            swing.JCheckBox("Laptop", actionPerformed=self.checkCallback))
        thirdTab.add(tmpPanel)

        tmpPanel = swing.JPanel()
        tmpPanel.layout = awt.GridLayout(4, 1)
        tmpPanel.border = swing.BorderFactory.createTitledBorder("My Pets")
        #
        # A ButtonGroup is used to indicate which radio buttons
        # go together.
        #
        buttonGroup = swing.ButtonGroup()

        radioButton = swing.JRadioButton("Dog",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        radioButton = swing.JRadioButton("Cat",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        radioButton = swing.JRadioButton("Pig",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        radioButton = swing.JRadioButton("Capybara",
                                         actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        tmpPanel.add(radioButton)

        thirdTab.add(tmpPanel)

        self.window.pack()
        self.window.show()
示例#9
0
toolMenu = toolbox.JMenuBar.getMenu(0)
sep = File.separator  # / for linux and \ for windows

toolbox.centerPanel.components[0].hide()  #comment out to initially show


#install menu items
def showConsole(event):
    toolbox.centerPanel.components[0].show()
    toolbox.pack()


toolMenu.add(
    swing.JMenuItem("Show Console",
                    actionPerformed=showConsole,
                    icon=swing.ImageIcon(startuppath + "images" + sep +
                                         "console_show.png")))


def hideConsole(event):
    toolbox.centerPanel.components[0].hide()
    toolbox.pack()


toolMenu.add(
    swing.JMenuItem("Hide Console",
                    actionPerformed=hideConsole,
                    icon=swing.ImageIcon(startuppath + "images" + sep +
                                         "console_hide.png")))
import UnionSelected  #too much code to inline.  use module

toolMenu.add(
示例#10
0
import com.vividsolutions.jump.workbench.ui.cursortool.NoteTool as NoteTool
toolbox.add(
    NoteTool())  #surprise!  Deselect before changing tools to avoid bug
#Custom Tools can be defined with only a constructor
lineTool = DrawCustomTool(featureDrawingUtil,
                          maxClicks=2,
                          toolName="Line Tool",
                          geometryType="linestring")
toolbox.add(featureDrawingUtil.prepare(lineTool, 1))
#this one creates multipoints.  Double-Click or Right-click to stop
multiPointTool = DrawCustomTool(featureDrawingUtil,
                                minClicks=2,
                                maxClicks=99,
                                toolName="MultiPoint Tool",
                                geometryType="POINT",
                                icon=swing.ImageIcon(startuppath + "images" +
                                                     sep + "DrawPoint.gif"))
toolbox.add(featureDrawingUtil.prepare(multiPointTool, 1))

#Custom Tools can be defined with only an inline function and constructor
import org.openjump.core.geomutils.GeoUtils as GeoUtils  #imports are executable and can go anywhere


#jython statements with the same indention are considered a block
def corner(event):  #this event handler won't fire until fireClicks points
    p = event.coords  #set p to the current array of coordinates
    dist = p[2].distance(GeoUtils.getClosestPointOnLine(p[2], p[0], p[1]))
    toLeft = not GeoUtils.pointToRight(p[2], p[1], p[0])
    p[2] = GeoUtils.perpendicularVector(p[1], p[0], dist, toLeft)
toCorner = DrawCustomTool(featureDrawingUtil, finalDraw=corner, \
            minClicks = 3, maxClicks = 3, toolName = "Corner Tool", \
            icon = swing.ImageIcon(startuppath + "images" + sep + "DrawCorner.gif"), \
示例#11
0
    def openJythonShell(self):

        js = ijcl.getJythonShell()
        jd = js.getDelegate()
        config = g.app.config
        c = self.c

        import leoSwingFrame
        getColorInstance = leoSwingFrame.getColorInstance

        colorconfig = js.getColorConfiguration()
        color = config.getColor(c, "jyshell_background")
        colorconfig.setBackgroundColor(getColorInstance(
            color, awt.Color.WHITE))

        color = config.getColor(c, "jyshell_foreground")
        colorconfig.setForegroundColor(getColorInstance(color, awt.Color.GRAY))

        color = config.getColor(c, "jyshell_keyword")
        colorconfig.setKeywordColor(getColorInstance(color, awt.Color.GREEN))

        color = config.getColor(c, "jyshell_local")
        colorconfig.setLocalColor(getColorInstance(color, awt.Color.ORANGE))

        color = config.getColor(c, "jyshell_ps1color")
        colorconfig.setPromptOneColor(getColorInstance(color, awt.Color.BLUE))

        color = config.getColor(c, "jyshell_ps2color")
        colorconfig.setPromptTwoColor(getColorInstance(color, awt.Color.GREEN))

        color = config.getColor(c, "jyshell_syntax")
        colorconfig.setSyntaxColor(getColorInstance(color, awt.Color.RED))

        color = config.getColor(c, "jyshell_output")
        colorconfig.setOutColor(getColorInstance(color, awt.Color.GRAY))

        color = config.getColor(c, "jyshell_error")
        colorconfig.setErrColor(getColorInstance(color, awt.Color.RED))

        family = config.get(c, "jyshell_text_font_family", "family")
        size = config.get(c, "jyshell_text_font_size", "size")
        weight = config.get(c, "jyshell_text_font_weight", "weight")
        slant = None
        font = config.getFontFromParams(c, "jyshell_text_font_family",
                                        "jyshell_text_font_size", None,
                                        "jyshell_text_font_weight")

        use_bgimage = g.app.config.getBool(c, "jyshell_background_image")
        if use_bgimage:

            image_location = g.app.config.getString(
                c, "jyshell_image_location@as-filedialog")
            test_if_exists = java.io.File(image_location)
            if test_if_exists.exists():
                ii = swing.ImageIcon(image_location)
                alpha = g.app.config.getFloat(c, "jyshell_background_alpha")
                js.setBackgroundImage(ii.getImage(), float(alpha))

        if font:
            js.setFont(font)

        js.setVisible(True)
        widget = js.getWidget()
        log = self.c.frame.log
        self.addMenuToJythonShell(js)
        log.addTab("JythonShell", widget)
        log.selectTab(widget)
slayout = swing.SpringLayout()
jmb2.setLayout(slayout)
slayout.putConstraint(slayout.WEST, jb, 0, slayout.WEST, jmb2)
slayout.putConstraint(slayout.SOUTH, jmb2, 0, slayout.SOUTH, jb)

slayout.putConstraint(slayout.WEST, jm, 0, slayout.EAST, jb)
slayout.putConstraint(slayout.NORTH, jm, 0, slayout.NORTH, jb)
slayout.putConstraint(slayout.SOUTH, jm, 0, slayout.SOUTH, jb)
slayout.putConstraint(slayout.EAST, jmb2, 0, slayout.EAST, jm)
slayout.putConstraint(slayout.NORTH, jmb2, 0, slayout.NORTH, jb)

#jmb.add( jmb2 )
jmb3 = swing.JMenuBar()
jmb3.add(jmb2)
jf.add(jmb3)
ii = swing.ImageIcon("/home/brihar/jyportLeo/arrow.gif")
ii2 = swing.ImageIcon("/home/brihar/jyportLeo/moveup.gif")
jb.setIcon(ii2)
jb.setVerticalTextPosition(jb.BOTTOM)
jb.setHorizontalTextPosition(jb.CENTER)
jmi = swing.JMenuItem("BORK")
jm.add(jmi)
jm.setIcon(ii)
#jm.addMouseListener( fl( jm ) )
#jm.setFocusable( True )
#jm.setRolloverEnabled( 1 )
#jm.setFocusPainted( True )
#jm.setBorder( sborder.LineBorder( awt.Color.BLACK ) )
jm2 = swing.JMenu("GOOD")
jm.add(jm2)
示例#13
0
    def createWidgets(self):

        blayout = java.awt.BorderLayout()
        self.setLayout(blayout)
        #hbox = swing.JPanel( java.awt.GridLayout( 1, 2 ) )
        #tcontainer = swing.JPanel( java.awt.BorderLayout() )
        #self.slist = slist = swing.JTable()
        #slist.getSelectionModel().setSelectionMode( swing.ListSelectionModel.SINGLE_SELECTION )
        #rh = slist.getRowHeight()
        #pvs = slist.getPreferredScrollableViewportSize()
        #pvs2 = pvs.clone()
        #pvs2.height = rh * 5
        #slist.setPreferredScrollableViewportSize( pvs2 )
        #lsp = swing.JScrollPane( slist )
        #tcontainer.add( lsp, java.awt.BorderLayout.CENTER )
        #hbox.add( tcontainer )

        self.commentarea = commentarea = swing.JTextPane()
        #self.__configureEditor()
        CutCopyPaste(commentarea)
        self.csp = csp = swing.JScrollPane(commentarea)
        self.backdrop = swing.JPanel()
        overlay = swing.OverlayLayout(self.backdrop)
        self.backdrop.setLayout(overlay)
        self.backdrop.add(csp)
        mb_ca = swing.JPanel(java.awt.BorderLayout())
        mb_ca.add(self.backdrop, java.awt.BorderLayout.CENTER)
        mb = swing.JMenuBar()
        #jm = swing.JMenu( "Options" )
        #mb.add( jm )
        #jmi = swing.JCheckBoxMenuItem( "Show Comments In Outline" )
        #jm.add( jmi )
        #jmi.setState( 1 )
        #jmi.actionPerformed = self.__showCommentsInOutline
        mb_ca.add(mb, java.awt.BorderLayout.NORTH)
        #hbox.add( mb_ca )
        #self.add( hbox, java.awt.BorderLayout.CENTER )
        self.add(mb_ca)
        self.__configureEditor()
        #jm.add( tcontainer )
        #jm2 = swing.JMenu( "Commentaries" )

        #jm2.add( tcontainer )
        #mb.add( jm2 )

        aballoon = swing.ImageIcon(
            g.os_path_join(g.app.loadDir, "..", "Icons", "AddTBalloon.gif"))
        sballoon = swing.ImageIcon(
            g.os_path_join(g.app.loadDir, "..", "Icons",
                           "SubtractTBalloon.gif"))
        #bpanel = swing.JPanel()
        add = swing.JMenuItem("Add Comment", aballoon)
        add.setToolTipText("Add Comment")
        add.actionPerformed = self.addComment
        remove = swing.JMenuItem("Remove Comment", sballoon)
        remove.setToolTipText("Remove Comment")
        remove.actionPerformed = self.removeComment
        #bpanel.add( add )
        #bpanel.add( remove )
        #tcontainer.add( bpanel, java.awt.BorderLayout.SOUTH )
        jm2 = swing.JMenu("Commentaries")
        jmi = swing.JCheckBoxMenuItem("Show Comments In Outline")
        jm2.add(jmi)
        jmi.setState(1)
        jmi.actionPerformed = self.__showCommentsInOutline
        jm2.add(add)
        jm2.add(remove)
        #jm2.add( tcontainer )
        mb.add(jm2)

        self.ccbmodel = self.CommentCBModel(self)
        self.jcb = jcb = swing.JComboBox(self.ccbmodel)
        #print jcb.getEditor().getEditorComponent().__class__.__bases__
        self.jcb.getEditor().getEditorComponent().getDocument(
        ).addDocumentListener(self.ccbmodel)
        jcb.addItemListener(self)
        jcb.setEditable(1)
        mb.add(jcb)
示例#14
0
featureDrawingUtil = FeatureDrawingUtil(toolbox.getContext())
toolMenu = toolbox.JMenuBar.getMenu(0)
sep = File.separator  # / for linux and \ for windows

#toolbox.centerPanel.components[0].hide() #comment out to initially show
#install menu items
#def showConsole(event): toolbox.centerPanel.components[0].show(); toolbox.pack()
#toolMenu.add(swing.JMenuItem("Show Console", actionPerformed=showConsole, icon = swing.ImageIcon(startuppath + "images" + sep +  "console_show.png")))
#def hideConsole(event): toolbox.centerPanel.components[0].hide(); toolbox.pack()
#toolMenu.add(swing.JMenuItem("Hide Console", actionPerformed=hideConsole, icon = swing.ImageIcon(startuppath + "images" + sep +  "console_hide.png")))
#import UnionSelected  #too much code to inline.  use module
#toolMenu.add(swing.JMenuItem("Union Selected", actionPerformed=UnionSelected.unionSelected, icon = swing.ImageIcon(startuppath + "images" + sep #+ "features_merge.png")))
import AlignSelected
alignMenu = swing.JMenu("Align Selected",
                        icon=swing.ImageIcon(startuppath + "images" + sep +
                                             "shape_align_left.png"))
alignLeftMenu = swing.JMenuItem(
    "Left",
    actionPerformed=AlignSelected.alignLeft,
    icon=swing.ImageIcon(startuppath + "images" + sep +
                         "shape_align_left.png"))
alignRightMenu = swing.JMenuItem(
    "Right",
    actionPerformed=AlignSelected.alignRight,
    icon=swing.ImageIcon(startuppath + "images" + sep +
                         "shape_align_right.png"))
alignTopMenu = swing.JMenuItem(
    "Top",
    actionPerformed=AlignSelected.alignTop,
    icon=swing.ImageIcon(startuppath + "images" + sep + "shape_align_top.png"))
alignBottomMenu = swing.JMenuItem(