def __init__(self, app): #java import from javax.swing import JPanel, JButton, JLabel, ImageIcon,\ JScrollPane, BorderFactory, WindowConstants,\ BoxLayout, Box from java.awt import FlowLayout, Dimension, Component from java.io import File #josm import from org.openstreetmap.josm import Main from org.openstreetmap.josm.tools import ImageProvider from org.openstreetmap.josm.gui.widgets import HtmlPanel, UrlLabel JDialog.__init__(self, Main.parent, app.strings.getString("error_info_title"), True) self.app = app self.setSize(400, 480) border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) #Intro intro = HtmlPanel("<html><i>%s</i></html>" % self.app.strings.getString("error_info_intro")) intro.setAlignmentX(Component.LEFT_ALIGNMENT) #User info userLbl = JLabel(self.app.strings.getString("Last_user")) userLbl.setAlignmentX(JLabel.LEFT_ALIGNMENT) self.userInfoPanel = HtmlPanel() self.userInfoPanel.getEditorPane().addHyperlinkListener(self) self.userInfoPanel.setAlignmentX(Component.LEFT_ALIGNMENT) #Panel with current error's info errorLbl = JLabel(self.app.strings.getString("Error_info")) errorLbl.setAlignmentX(JLabel.LEFT_ALIGNMENT) self.errorInfoPanel = HtmlPanel() self.errorInfoPanel.getEditorPane().addHyperlinkListener(self) self.scrollPane = JScrollPane(self.errorInfoPanel) self.scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT) #OK button btnPanel = JPanel(FlowLayout(FlowLayout.CENTER)) okBtn = JButton(self.app.strings.getString("OK"), ImageProvider.get("ok"), actionPerformed=self.on_okBtn_clicked) btnPanel.add(okBtn) btnPanel.setAlignmentX(Component.LEFT_ALIGNMENT) #Layout self.add(intro) self.add(Box.createRigidArea(Dimension(0, 7))) self.add(userLbl) self.add(Box.createRigidArea(Dimension(0, 5))) self.add(self.userInfoPanel) self.add(Box.createRigidArea(Dimension(0, 7))) self.add(errorLbl) self.add(Box.createRigidArea(Dimension(0, 5))) self.add(self.scrollPane) self.add(Box.createRigidArea(Dimension(0, 7))) self.add(btnPanel) self.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)
def __init__(self, parent, title, app): from javax.swing import JCheckBox, JRadioButton, ButtonGroup self.app = app border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.getContentPane().setLayout(BorderLayout(0, 5)) self.tabbedPane = JTabbedPane() #1 Tab: general panel1 = JPanel() panel1.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)) panel1.setLayout(BoxLayout(panel1, BoxLayout.PAGE_AXIS)) #Checkbutton to enable/disable update check when script starts self.updateCBtn = JCheckBox(self.app.strings.getString("updateCBtn")) self.updateCBtn.setToolTipText( self.app.strings.getString("updateCBtn_tooltip")) #Download tools downloadBtn = JButton(self.app.strings.getString("updatesBtn"), ImageProvider.get("dialogs", "refresh"), actionPerformed=self.on_downloadBtn_clicked) downloadBtn.setToolTipText( self.app.strings.getString("updatesBtn_tooltip")) #Checkbuttons for enabling/disabling tools toolsPanel = JPanel(BorderLayout(0, 5)) title = self.app.strings.getString("enable_disable_tools") toolsPanel.setBorder(BorderFactory.createTitledBorder(title)) infoLbl = JLabel(self.app.strings.getString("JOSM_restart_warning")) infoLbl.setFont(infoLbl.getFont().deriveFont(Font.ITALIC)) toolsPanel.add(infoLbl, BorderLayout.PAGE_START) toolsStatusPane = JPanel(GridLayout(len(self.app.realTools), 0)) self.toolsCBtns = [] for tool in self.app.realTools: toolCBtn = JCheckBox() toolCBtn.addItemListener(self) toolLbl = JLabel(tool.title, tool.bigIcon, JLabel.LEFT) self.toolsCBtns.append(toolCBtn) toolPane = JPanel() toolPane.setLayout(BoxLayout(toolPane, BoxLayout.X_AXIS)) toolPane.add(toolCBtn) toolPane.add(toolLbl) toolsStatusPane.add(toolPane) toolsPanel.add(toolsStatusPane, BorderLayout.CENTER) #Radiobuttons for enabling/disabling layers when a new one #is added layersPanel = JPanel(GridLayout(0, 1)) title = self.app.strings.getString("errors_layers_manager") layersPanel.setBorder(BorderFactory.createTitledBorder(title)) errorLayersLbl = JLabel( self.app.strings.getString("errors_layers_info")) errorLayersLbl.setFont(errorLayersLbl.getFont().deriveFont( Font.ITALIC)) layersPanel.add(errorLayersLbl) self.layersRBtns = {} group = ButtonGroup() for mode in self.app.layersModes: layerRBtn = JRadioButton(self.app.strings.getString("%s" % mode)) group.add(layerRBtn) layersPanel.add(layerRBtn) self.layersRBtns[mode] = layerRBtn #Max number of errors text field self.maxErrorsNumberTextField = JTextField() self.maxErrorsNumberTextField.setToolTipText( self.app.strings.getString("maxErrorsNumberTextField_tooltip")) self.maxErrorsNumberTFieldDefaultBorder = self.maxErrorsNumberTextField.getBorder( ) self.maxErrorsNumberTextField.getDocument().addDocumentListener( ErrNumTextListener(self)) #layout self.updateCBtn.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(self.updateCBtn) panel1.add(Box.createRigidArea(Dimension(0, 15))) downloadBtn.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(downloadBtn) panel1.add(Box.createRigidArea(Dimension(0, 15))) toolsPanel.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(toolsPanel) panel1.add(Box.createRigidArea(Dimension(0, 15))) layersPanel.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(layersPanel) panel1.add(Box.createRigidArea(Dimension(0, 15))) maxErrP = JPanel(BorderLayout(5, 0)) maxErrP.add(JLabel(self.app.strings.getString("max_errors_number")), BorderLayout.LINE_START) maxErrP.add(self.maxErrorsNumberTextField, BorderLayout.CENTER) p = JPanel(BorderLayout()) p.add(maxErrP, BorderLayout.PAGE_START) p.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(p) self.tabbedPane.addTab(self.app.strings.getString("tab_1_title"), None, panel1, None) #2 Tab: favourite zones panel2 = JPanel(BorderLayout(5, 15)) panel2.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)) #status topPanel = JPanel() topPanel.setLayout(BoxLayout(topPanel, BoxLayout.Y_AXIS)) infoPanel = HtmlPanel(self.app.strings.getString("fav_zones_info")) infoPanel.getEditorPane().addHyperlinkListener(self) infoPanel.setAlignmentX(Component.LEFT_ALIGNMENT) self.favZoneStatusCBtn = JCheckBox( self.app.strings.getString("activate_fav_area"), actionListener=self) self.favZoneStatusCBtn.setToolTipText( self.app.strings.getString("activate_fav_area_tooltip")) self.favZoneStatusCBtn.setAlignmentX(Component.LEFT_ALIGNMENT) topPanel.add(infoPanel) topPanel.add(Box.createRigidArea(Dimension(0, 10))) topPanel.add(self.favZoneStatusCBtn) #table self.zonesTable = JTable() tableSelectionModel = self.zonesTable.getSelectionModel() tableSelectionModel.addListSelectionListener(ZonesTableListener(self)) columns = [ "", self.app.strings.getString("Type"), self.app.strings.getString("Name") ] tableModel = ZonesTableModel([], columns) self.zonesTable.setModel(tableModel) self.scrollPane = JScrollPane(self.zonesTable) #map self.zonesMap = JMapViewer() self.zonesMap.setZoomContolsVisible(False) self.zonesMap.setMinimumSize(Dimension(100, 200)) #buttons self.removeBtn = JButton(self.app.strings.getString("Remove"), ImageProvider.get("dialogs", "delete"), actionPerformed=self.on_removeBtn_clicked) self.removeBtn.setToolTipText( self.app.strings.getString("remove_tooltip")) newBtn = JButton(self.app.strings.getString("New"), ImageProvider.get("dialogs", "add"), actionPerformed=self.on_newBtn_clicked) newBtn.setToolTipText(self.app.strings.getString("new_tooltip")) #layout panel2.add(topPanel, BorderLayout.PAGE_START) panel2.add(self.scrollPane, BorderLayout.LINE_START) panel2.add(self.zonesMap, BorderLayout.CENTER) self.buttonsPanel = JPanel() self.buttonsPanel.add(self.removeBtn) self.buttonsPanel.add(newBtn) panel2.add(self.buttonsPanel, BorderLayout.PAGE_END) self.tabbedPane.addTab(self.app.strings.getString("tab_2_title"), None, panel2, None) #3 Tab Tools options panel3 = JPanel() panel3.setLayout(BoxLayout(panel3, BoxLayout.Y_AXIS)) panel3.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)) for tool in self.app.realTools: if hasattr(tool, 'prefs'): p = JPanel(FlowLayout(FlowLayout.LEFT)) p.setBorder(BorderFactory.createTitledBorder(tool.title)) p.add(tool.prefsGui) panel3.add(p) self.tabbedPane.addTab(self.app.strings.getString("tab_3_title"), None, panel3, None) self.add(self.tabbedPane, BorderLayout.CENTER) exitPanel = JPanel() saveBtn = JButton(self.app.strings.getString("OK"), ImageProvider.get("ok"), actionPerformed=self.on_saveBtn_clicked) cancelBtn = JButton(self.app.strings.getString("cancel"), ImageProvider.get("cancel"), actionPerformed=self.on_cancelBtn_clicked) saveBtn.setToolTipText(self.app.strings.getString("save_preferences")) saveBtn.setAlignmentX(0.5) exitPanel.add(saveBtn) exitPanel.add(cancelBtn) self.add(exitPanel, BorderLayout.PAGE_END) self.addWindowListener(self) self.pack()
class ErrorInfoDialog(JDialog, HyperlinkListener): """Dialog which shows info regarding the currently selcted error, so that the user can copy its info and send a message to the user who possibly made the error. """ def __init__(self, app): #java import from javax.swing import JPanel, JButton, JLabel, ImageIcon,\ JScrollPane, BorderFactory, WindowConstants,\ BoxLayout, Box from java.awt import FlowLayout, Dimension, Component from java.io import File #josm import from org.openstreetmap.josm import Main from org.openstreetmap.josm.tools import ImageProvider from org.openstreetmap.josm.gui.widgets import HtmlPanel, UrlLabel JDialog.__init__(self, Main.parent, app.strings.getString("error_info_title"), True) self.app = app self.setSize(400, 480) border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.setLayout(BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)) #Intro intro = HtmlPanel("<html><i>%s</i></html>" % self.app.strings.getString("error_info_intro")) intro.setAlignmentX(Component.LEFT_ALIGNMENT) #User info userLbl = JLabel(self.app.strings.getString("Last_user")) userLbl.setAlignmentX(JLabel.LEFT_ALIGNMENT) self.userInfoPanel = HtmlPanel() self.userInfoPanel.getEditorPane().addHyperlinkListener(self) self.userInfoPanel.setAlignmentX(Component.LEFT_ALIGNMENT) #Panel with current error's info errorLbl = JLabel(self.app.strings.getString("Error_info")) errorLbl.setAlignmentX(JLabel.LEFT_ALIGNMENT) self.errorInfoPanel = HtmlPanel() self.errorInfoPanel.getEditorPane().addHyperlinkListener(self) self.scrollPane = JScrollPane(self.errorInfoPanel) self.scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT) #OK button btnPanel = JPanel(FlowLayout(FlowLayout.CENTER)) okBtn = JButton(self.app.strings.getString("OK"), ImageProvider.get("ok"), actionPerformed=self.on_okBtn_clicked) btnPanel.add(okBtn) btnPanel.setAlignmentX(Component.LEFT_ALIGNMENT) #Layout self.add(intro) self.add(Box.createRigidArea(Dimension(0, 7))) self.add(userLbl) self.add(Box.createRigidArea(Dimension(0, 5))) self.add(self.userInfoPanel) self.add(Box.createRigidArea(Dimension(0, 7))) self.add(errorLbl) self.add(Box.createRigidArea(Dimension(0, 5))) self.add(self.scrollPane) self.add(Box.createRigidArea(Dimension(0, 7))) self.add(btnPanel) self.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE) def update(self): """Update information shown by the dialog with those of currently selected error """ from java.net import URL, URLEncoder from javax.xml.parsers import DocumentBuilderFactory error = self.app.selectedError check = error.check view = check.view tool = view.tool #user info if error.user is not None: errorUserName = error.user.getName() errorUserId = str(error.user.getId()) #download user info from OSM API accountDate = None changesetsNumber = None if errorUserId in self.app.users: userInfo = self.app.users[errorUserId] accountDate = userInfo["account date"] changesetsNumber = userInfo["changesets number"] else: docFactory = DocumentBuilderFactory.newInstance() docBuilder = docFactory.newDocumentBuilder() url = URL("http://api.openstreetmap.org/api/0.6/user/" + errorUserId) try: stream = url.openStream() doc = docBuilder.parse(stream) rootElement = doc.getDocumentElement() userNode = rootElement.getElementsByTagName("user").item(0) accountDate = userNode.getAttributes().getNamedItem("account_created").getNodeValue() changesetsNode = rootElement.getElementsByTagName("changesets").item(0) changesetsNumber = changesetsNode.getAttributes().getNamedItem("count").getNodeValue() except: print "I could not download user info from:\n", url pass if accountDate is not None: self.app.users[errorUserId] = {"account date": accountDate, "changesets number": changesetsNumber} #user links encodedErrorUserName = URLEncoder.encode(errorUserName, "UTF-8").replace("+", "%20") userUrl = "http://www.openstreetmap.org/user/%s/" % encodedErrorUserName msgUrl = "http://www.openstreetmap.org/message/new/%s" % encodedErrorUserName #update user info text = "<html><table>" text += "<tr><td>%s</td>" % self.app.strings.getString("User_name") text += "<td><a href='%s'>%s</a></td></tr>" % (userUrl, errorUserName) if accountDate is not None: text += "<tr>" text += "<td>%s</td>" % self.app.strings.getString("Changesets") text += "<td>%s</td>" % changesetsNumber text += "</tr><tr>" text += "<td>%s</td>" % self.app.strings.getString("Mapper_since") text += "<td>%s</td>" % accountDate[:10] text += "</tr>" text += "</table>" text += "<a href='%s'>%s</a>" % (msgUrl, self.app.strings.getString("Send_a_message")) text += "</html>" self.userInfoPanel.setText(text) #error info text = "<html>" #tool text += "%s:<br>%s" % (self.app.strings.getString("Error_reported_by_the_tool"), tool.title) if tool.uri != "": text += "<br>%s" % self.link(tool.uri) #error type if not tool.isLocal: text += "<br><br>%s:" % self.app.strings.getString("Type_of_error") text += "<br>%s --> %s" % (view.title, check.title) #error help, usually a link to a Wiki page describing this errror type #error link, e.g. a link to the error on the tool web page for propName, prop in ((self.app.strings.getString("Error_help"),\ check.helpUrl), (self.app.strings.getString("Error_link"), tool.error_url(error))): if prop != "": text += "<br><br>%s:" % propName text += "<br>%s" % self.link(prop) #error description, usually some info contained in the error file if error.desc != "": text += "<br><br>%s:" % self.app.strings.getString("Description") text += "<br>%s" % error.desc #OSM object if error.osmId != "": osmType = {"n": "node", "w": "way", "r": "relation"} osmLinks = "" osmIds = error.osmId.split("_") for i, osmId in enumerate(osmIds): osmIdUrl = "http://www.openstreetmap.org/%s/%s" % (osmType[osmId[0]], osmId[1:]) osmLinks += self.link(osmIdUrl) if i != len(osmIds) - 1: osmLinks += "<br>" text += "<br><br>%s:" % self.app.strings.getString("OSM_objects") text += "<br>%s" % osmLinks #OSM changeset if error.changeset is not None: changesetUrl = "http://www.openstreetmap.org/changeset/%s" % error.changeset text += "<br><br>%s:" % self.app.strings.getString("OSM_changeset") text += "<br>%s" % self.link(changesetUrl) text += "</html>" #Update error info self.errorInfoPanel.setText(text) self.show() def link(self, url): link = "<a href='%s'>%s</a>" % (url, url) return link def hyperlinkUpdate(self, e): if e.getEventType() == HyperlinkEvent.EventType.ACTIVATED: OpenBrowser.displayUrl(e.getURL().toString()) def on_okBtn_clicked(self, event): """Dispose Error Info Dialog when ok button is clicked """ self.hide()
def __init__(self, parent, title, app): from javax.swing import JCheckBox, JRadioButton, ButtonGroup self.app = app border = BorderFactory.createEmptyBorder(5, 7, 5, 7) self.getContentPane().setBorder(border) self.getContentPane().setLayout(BorderLayout(0, 5)) self.tabbedPane = JTabbedPane() #1 Tab: general panel1 = JPanel() panel1.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)) panel1.setLayout(BoxLayout(panel1, BoxLayout.PAGE_AXIS)) #Checkbutton to enable/disable update check when script starts self.updateCBtn = JCheckBox(self.app.strings.getString("updateCBtn")) self.updateCBtn.setToolTipText(self.app.strings.getString("updateCBtn_tooltip")) #Download tools downloadBtn = JButton(self.app.strings.getString("updatesBtn"), ImageProvider.get("dialogs", "refresh"), actionPerformed=self.on_downloadBtn_clicked) downloadBtn.setToolTipText(self.app.strings.getString("updatesBtn_tooltip")) #Checkbuttons for enabling/disabling tools toolsPanel = JPanel(BorderLayout(0, 5)) title = self.app.strings.getString("enable_disable_tools") toolsPanel.setBorder(BorderFactory.createTitledBorder(title)) infoLbl = JLabel(self.app.strings.getString("JOSM_restart_warning")) infoLbl.setFont(infoLbl.getFont().deriveFont(Font.ITALIC)) toolsPanel.add(infoLbl, BorderLayout.PAGE_START) toolsStatusPane = JPanel(GridLayout(len(self.app.realTools), 0)) self.toolsCBtns = [] for tool in self.app.realTools: toolCBtn = JCheckBox() toolCBtn.addItemListener(self) toolLbl = JLabel(tool.title, tool.bigIcon, JLabel.LEFT) self.toolsCBtns.append(toolCBtn) toolPane = JPanel() toolPane.setLayout(BoxLayout(toolPane, BoxLayout.X_AXIS)) toolPane.add(toolCBtn) toolPane.add(toolLbl) toolsStatusPane.add(toolPane) toolsPanel.add(toolsStatusPane, BorderLayout.CENTER) #Radiobuttons for enabling/disabling layers when a new one #is added layersPanel = JPanel(GridLayout(0, 1)) title = self.app.strings.getString("errors_layers_manager") layersPanel.setBorder(BorderFactory.createTitledBorder(title)) errorLayersLbl = JLabel(self.app.strings.getString("errors_layers_info")) errorLayersLbl.setFont(errorLayersLbl.getFont().deriveFont(Font.ITALIC)) layersPanel.add(errorLayersLbl) self.layersRBtns = {} group = ButtonGroup() for mode in self.app.layersModes: layerRBtn = JRadioButton(self.app.strings.getString("%s" % mode)) group.add(layerRBtn) layersPanel.add(layerRBtn) self.layersRBtns[mode] = layerRBtn #Max number of errors text field self.maxErrorsNumberTextField = JTextField() self.maxErrorsNumberTextField.setToolTipText(self.app.strings.getString("maxErrorsNumberTextField_tooltip")) self.maxErrorsNumberTFieldDefaultBorder = self.maxErrorsNumberTextField.getBorder() self.maxErrorsNumberTextField.getDocument().addDocumentListener(ErrNumTextListener(self)) #layout self.updateCBtn.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(self.updateCBtn) panel1.add(Box.createRigidArea(Dimension(0, 15))) downloadBtn.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(downloadBtn) panel1.add(Box.createRigidArea(Dimension(0, 15))) toolsPanel.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(toolsPanel) panel1.add(Box.createRigidArea(Dimension(0, 15))) layersPanel.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(layersPanel) panel1.add(Box.createRigidArea(Dimension(0, 15))) maxErrP = JPanel(BorderLayout(5, 0)) maxErrP.add(JLabel(self.app.strings.getString("max_errors_number")), BorderLayout.LINE_START) maxErrP.add(self.maxErrorsNumberTextField, BorderLayout.CENTER) p = JPanel(BorderLayout()) p.add(maxErrP, BorderLayout.PAGE_START) p.setAlignmentX(Component.LEFT_ALIGNMENT) panel1.add(p) self.tabbedPane.addTab(self.app.strings.getString("tab_1_title"), None, panel1, None) #2 Tab: favourite zones panel2 = JPanel(BorderLayout(5, 15)) panel2.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)) #status topPanel = JPanel() topPanel.setLayout(BoxLayout(topPanel, BoxLayout.Y_AXIS)) infoPanel = HtmlPanel(self.app.strings.getString("fav_zones_info")) infoPanel.getEditorPane().addHyperlinkListener(self) infoPanel.setAlignmentX(Component.LEFT_ALIGNMENT) self.favZoneStatusCBtn = JCheckBox(self.app.strings.getString("activate_fav_area"), actionListener=self) self.favZoneStatusCBtn.setToolTipText(self.app.strings.getString("activate_fav_area_tooltip")) self.favZoneStatusCBtn.setAlignmentX(Component.LEFT_ALIGNMENT) topPanel.add(infoPanel) topPanel.add(Box.createRigidArea(Dimension(0, 10))) topPanel.add(self.favZoneStatusCBtn) #table self.zonesTable = JTable() tableSelectionModel = self.zonesTable.getSelectionModel() tableSelectionModel.addListSelectionListener(ZonesTableListener(self)) columns = ["", self.app.strings.getString("Type"), self.app.strings.getString("Name")] tableModel = ZonesTableModel([], columns) self.zonesTable.setModel(tableModel) self.scrollPane = JScrollPane(self.zonesTable) #map self.zonesMap = JMapViewer() self.zonesMap.setZoomContolsVisible(False) self.zonesMap.setMinimumSize(Dimension(100, 200)) #buttons self.removeBtn = JButton(self.app.strings.getString("Remove"), ImageProvider.get("dialogs", "delete"), actionPerformed=self.on_removeBtn_clicked) self.removeBtn.setToolTipText(self.app.strings.getString("remove_tooltip")) newBtn = JButton(self.app.strings.getString("New"), ImageProvider.get("dialogs", "add"), actionPerformed=self.on_newBtn_clicked) newBtn.setToolTipText(self.app.strings.getString("new_tooltip")) #layout panel2.add(topPanel, BorderLayout.PAGE_START) panel2.add(self.scrollPane, BorderLayout.LINE_START) panel2.add(self.zonesMap, BorderLayout.CENTER) self.buttonsPanel = JPanel() self.buttonsPanel.add(self.removeBtn) self.buttonsPanel.add(newBtn) panel2.add(self.buttonsPanel, BorderLayout.PAGE_END) self.tabbedPane.addTab(self.app.strings.getString("tab_2_title"), None, panel2, None) #3 Tab Tools options panel3 = JPanel() panel3.setLayout(BoxLayout(panel3, BoxLayout.Y_AXIS)) panel3.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)) for tool in self.app.realTools: if hasattr(tool, 'prefs'): p = JPanel(FlowLayout(FlowLayout.LEFT)) p.setBorder(BorderFactory.createTitledBorder(tool.title)) p.add(tool.prefsGui) panel3.add(p) self.tabbedPane.addTab(self.app.strings.getString("tab_3_title"), None, panel3, None) self.add(self.tabbedPane, BorderLayout.CENTER) exitPanel = JPanel() saveBtn = JButton(self.app.strings.getString("OK"), ImageProvider.get("ok"), actionPerformed=self.on_saveBtn_clicked) cancelBtn = JButton(self.app.strings.getString("cancel"), ImageProvider.get("cancel"), actionPerformed=self.on_cancelBtn_clicked) saveBtn.setToolTipText(self.app.strings.getString("save_preferences")) saveBtn.setAlignmentX(0.5) exitPanel.add(saveBtn) exitPanel.add(cancelBtn) self.add(exitPanel, BorderLayout.PAGE_END) self.addWindowListener(self) self.pack()