def main(): activeLayers=getActiveLayers() if len(activeLayers)==0: JOptionPane.showMessageDialog(None, "Add and activate at least one vector layer in the view. Retry!", "Batch Transparency", JOptionPane.WARNING_MESSAGE) return else: numFLyrVect=0 for i in range(len(activeLayers)): if activeLayers[i].getClass().getCanonicalName()=="com.iver.cit.gvsig.fmap.layers.FLyrVect": numFLyrVect=numFLyrVect+1 if numFLyrVect==0: JOptionPane.showMessageDialog(None, "You have to add and activate at least one vector layer in the view. Retry!", "Batch Transparency", JOptionPane.WARNING_MESSAGE) return else: global frame, outCheckbox, fillCheckbox, slider frame = JFrame("Batch Transparency", defaultCloseOperation=JFrame.DISPOSE_ON_CLOSE, bounds=(100, 100, 450, 80), layout=FlowLayout(), resizable=0) outCheckbox = JCheckBox("outline", 1) fillCheckbox = JCheckBox("fill", 1) # Create a horizontal slider with min=0, max=100, value=50 slider = JSlider() slider.setPreferredSize(Dimension(200, 50)) slider.setValue(100) slider.setMajorTickSpacing(25) slider.setMinorTickSpacing(5) slider.setPaintTicks(1) slider.setPaintLabels(1) applyButton = JButton("Apply", actionPerformed=action) acceptButton = JButton("Accept", actionPerformed=accept) frame.add(outCheckbox) frame.add(fillCheckbox) frame.add(slider) frame.add(applyButton) frame.add(acceptButton) frame.show() return
def getGUI(sym_dict): global frame, outCheckbox, fillCheckbox, slider, colorTF, widthTF frame = JFrame("Border Symbology", defaultCloseOperation=JFrame.DISPOSE_ON_CLOSE, bounds=(100, 100, 450, 200), layout=FlowLayout(), resizable=0) colorL = JLabel('Color: ') colorTF = JTextField(20) color = sym_dict["color"] color = Color(color.getRed(), color.getGreen(), color.getBlue(), sym_dict["alpha"]) colorTF.setBackground(color) colorTF.setText(color.toString()) colorB = JButton('...', actionPerformed=colorChooser) frame.add(colorL) frame.add(colorTF) frame.add(colorB) widthL = JLabel('Width: ') widthTF = JTextField(3) widthTF.setText(str(sym_dict["width"])) frame.add(widthL) frame.add(widthTF) alphaL = JLabel('Transparency: ') frame.add(alphaL) # Create a horizontal slider with min=0, max=100, value=50 slider = JSlider() slider.setPreferredSize(Dimension(200, 50)) slider.setValue(sym_dict["alpha"]*100/255) slider.setMajorTickSpacing(25) slider.setMinorTickSpacing(5) slider.setPaintTicks(1) slider.setPaintLabels(1) applyButton = JButton("Apply", actionPerformed=action) acceptButton = JButton("Accept", actionPerformed=accept) frame.add(slider) frame.add(applyButton) frame.add(acceptButton) frame.show()