List of usage examples for javax.swing UIManager getColor
public static Color getColor(Object key)
From source file:com.jvms.i18neditor.editor.Editor.java
private void setupUI() { Color borderColor = Colors.scale(UIManager.getColor("Panel.background"), .8f); setTitle(TITLE);/*from w w w . ja v a 2 s .c o m*/ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new EditorWindowListener()); setIconImages(Lists.newArrayList("512", "256", "128", "64", "48", "32", "24", "20", "16").stream() .map(size -> Images.loadFromClasspath("images/icon-" + size + ".png").getImage()) .collect(Collectors.toList())); translationTree = new TranslationTree(); translationTree.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); translationTree.addTreeSelectionListener(new TranslationTreeNodeSelectionListener()); translationTree.addMouseListener(new TranslationTreeMouseListener()); translationField = new TranslationField(); translationField.addKeyListener(new TranslationFieldKeyListener()); translationField.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 1, borderColor), ((CompoundBorder) translationField.getBorder()).getInsideBorder())); JScrollPane translationsScrollPane = new JScrollPane(translationTree); translationsScrollPane.getViewport().setOpaque(false); translationsScrollPane.setOpaque(false); translationsScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, borderColor)); translationsPanel = new JPanel(new BorderLayout()); translationsPanel.add(translationsScrollPane); translationsPanel.add(translationField, BorderLayout.SOUTH); resourcesPanel = new JScrollablePanel(true, false); resourcesPanel.setLayout(new BoxLayout(resourcesPanel, BoxLayout.Y_AXIS)); resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20)); resourcesPanel.setOpaque(false); resourcesPanel.addMouseListener(new ResourcesPaneMouseListener()); resourcesScrollPane = new JScrollPane(resourcesPanel); resourcesScrollPane.getViewport().setOpaque(false); resourcesScrollPane.setOpaque(false); resourcesScrollPane.setBorder(null); resourcesScrollPane.addMouseListener(new ResourcesPaneMouseListener()); contentPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, translationsPanel, resourcesScrollPane); contentPane.setBorder(null); contentPane.setDividerSize(10); // Style the split pane divider if possible SplitPaneUI splitPaneUI = contentPane.getUI(); if (splitPaneUI instanceof BasicSplitPaneUI) { BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPaneUI).getDivider(); divider.setBorder(null); resourcesPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 20)); } introText = new JLabel("<html><body style=\"text-align:center; padding:30px;\">" + MessageBundle.get("core.intro.text") + "</body></html>"); introText.setOpaque(true); introText.setFont(introText.getFont().deriveFont(28f)); introText.setHorizontalTextPosition(JLabel.CENTER); introText.setVerticalTextPosition(JLabel.BOTTOM); introText.setHorizontalAlignment(JLabel.CENTER); introText.setVerticalAlignment(JLabel.CENTER); introText.setForeground(getBackground().darker()); introText.setIcon(Images.loadFromClasspath("images/icon-intro.png")); Container container = getContentPane(); container.add(introText); editorMenu = new EditorMenuBar(this, translationTree); setJMenuBar(editorMenu); }
From source file:SortableTable.java
/** * Standard constructor - builds an icon with the specified attributes. * * @param direction ./*from w w w . j a v a 2 s . c o m*/ * @param isRaisedView . * @param isPressedView . */ public BevelArrowIcon(final int direction, final boolean isRaisedView, final boolean isPressedView) { if (isRaisedView) { if (isPressedView) { init(UIManager.getColor("controlLtHighlight"), UIManager.getColor("controlDkShadow"), UIManager.getColor("controlShadow"), DEFAULT_SIZE, direction); } else { init(UIManager.getColor("controlHighlight"), UIManager.getColor("controlShadow"), UIManager.getColor("control"), DEFAULT_SIZE, direction); } } else { if (isPressedView) { init(UIManager.getColor("controlDkShadow"), UIManager.getColor("controlLtHighlight"), UIManager.getColor("controlShadow"), DEFAULT_SIZE, direction); } else { init(UIManager.getColor("controlShadow"), UIManager.getColor("controlHighlight"), UIManager.getColor("control"), DEFAULT_SIZE, direction); } } }
From source file:ca.phon.ipamap.IpaMap.java
private JXButton getToggleButton(Grid grid, JXCollapsiblePane cp) { Action toggleAction = cp.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION); // use the collapse/expand icons from the JTree UI toggleAction.putValue(JXCollapsiblePane.COLLAPSE_ICON, UIManager.getIcon("Tree.expandedIcon")); toggleAction.putValue(JXCollapsiblePane.EXPAND_ICON, UIManager.getIcon("Tree.collapsedIcon")); toggleAction.putValue(Action.NAME, grid.getName()); JXButton btn = new JXButton(toggleAction) { @Override/*from w w w . ja va 2 s . c om*/ public Insets getInsets() { Insets retVal = super.getInsets(); retVal.top = 0; retVal.bottom = 0; return retVal; } @Override public Dimension getPreferredSize() { return new Dimension(0, 20); } }; btn.setHorizontalAlignment(SwingConstants.LEFT); btn.setBackgroundPainter(new Painter<JXButton>() { @Override public void paint(Graphics2D g, JXButton object, int width, int height) { MattePainter mp = new MattePainter(UIManager.getColor("Button.background")); mp.paint(g, object, width, height); } }); btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btn.setBorderPainted(false); btn.setFocusable(false); btn.putClientProperty("JComponent.sizeVariant", "small"); btn.revalidate(); return btn; }
From source file:com.juanhg.pot.PotApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); JLabel lblW = new JLabel("W:"); lblW.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblWValue = new JLabel(); lblWValue.setText("-"); lblWValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblQ = new JLabel("Q:"); lblQ.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblQValue = new JLabel(); lblQValue.setText("-"); lblQValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblT2 = new JLabel("T:"); lblT2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTOValue = new JLabel(); lblTOValue.setText("-"); lblTOValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblU = new JLabel("U:"); lblU.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblP = new JLabel("P:"); lblP.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVO = new JLabel("V:"); lblVO.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVOValue = new JLabel(); lblVOValue.setText("-"); lblVOValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPValue = new JLabel(); lblPValue.setText("-"); lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblUValue = new JLabel(); lblUValue.setText("-"); lblUValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(31).addGroup(gl_panelOutputs .createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblQ, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblWValue, GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) .addComponent(lblQValue, GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))) .addGroup(Alignment.LEADING, gl_panelOutputs.createSequentialGroup() .addComponent(lblT2, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblTOValue, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE))) .addGap(18)//from w w w . j a va2 s . c om .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblU, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE) .addGap(6).addComponent(lblUValue, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE) .addGap(6).addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblVO, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE) .addGap(6).addComponent(lblVOValue, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE))) .addGap(25))); gl_panelOutputs.setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs .createSequentialGroup().addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING).addGroup(gl_panelOutputs .createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblU, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblUValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(6) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(6) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVO, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblVOValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelOutputs.createSequentialGroup().addGroup(gl_panelOutputs .createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblQ, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblWValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblQValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblT2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblTOValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))) .addContainerGap())); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control .setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(Alignment.TRAILING, gl_panel_control.createSequentialGroup().addContainerGap() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addComponent(panelInputs, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panelLicense, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(24))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); lblT = new JLabel("Temperatura"); lblT.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblV = new JLabel("Volumen"); lblV.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMo = new JLabel("Masa Inicial"); lblMo.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblVValue = new JLabel("15"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMoValue = new JLabel("5"); lblMoValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTValue = new JLabel("300"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderT = new JSlider(); sliderT.setMinimum(280); sliderT.setMaximum(330); sliderT.setMinorTickSpacing(1); sliderT.setValue(300); sliderT.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderV = new JSlider(); sliderV.setMinimum(3); sliderV.setMaximum(30); sliderV.setMinorTickSpacing(1); sliderV.setValue(15); sliderV.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderMo = new JSlider(); sliderMo.setMinimum(1); sliderMo.setMaximum(1000); sliderMo.setValue(5); sliderMo.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); lblM = new JLabel("Masa Final"); lblM.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMValue = new JLabel("4"); lblMValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderM = new JSlider(); sliderM.setMinimum(1); sliderM.setMaximum(1000); sliderM.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderM.setValue(4); sliderM.setMinorTickSpacing(1); lblType = new JLabel("Combustible"); lblType.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTypeValue = new JLabel("Madera"); lblTypeValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderType = new JSlider(); sliderType.setMinimum(1); sliderType.setMaximum(4); sliderType.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI5Event(); } }); sliderType.setValue(1); sliderType.setMinorTickSpacing(1); lblMc = new JLabel("Masa Combustible"); lblMc.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMcValue = new JLabel("10"); lblMcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderMc = new JSlider(); sliderMc.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI6Event(); } }); sliderMc.setMinimum(1); sliderMc.setValue(10); sliderMc.setMinorTickSpacing(1); sliderMc.setMaximum(50); btn1 = new JButton("1"); btn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btn1function(); } }); btn2 = new JButton("2"); btn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btn1.setEnabled(true); btn2.setEnabled(false); btn3.setEnabled(true); lblT.setEnabled(true); lblTValue.setEnabled(true); sliderT.setEnabled(true); lblV.setEnabled(true); lblVValue.setEnabled(true); sliderV.setEnabled(true); lblMo.setEnabled(false); lblMoValue.setEnabled(false); sliderMo.setEnabled(false); lblM.setEnabled(false); lblMValue.setEnabled(false); sliderM.setEnabled(false); lblType.setEnabled(true); lblTypeValue.setEnabled(true); sliderType.setEnabled(true); lblMc.setEnabled(true); lblMcValue.setEnabled(true); sliderMc.setEnabled(true); model.setCurrentPhase(2); readInputs(); updateFire(); updateScrews(); updatePot(); updatePanels(); repaint(); } }); btn3 = new JButton("3"); btn3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btn1.setEnabled(true); btn2.setEnabled(true); btn3.setEnabled(false); lblT.setEnabled(true); lblTValue.setEnabled(true); sliderT.setEnabled(true); lblV.setEnabled(false); lblVValue.setEnabled(false); sliderV.setEnabled(false); lblMo.setEnabled(false); lblMoValue.setEnabled(false); sliderMo.setEnabled(false); lblM.setEnabled(true); lblMValue.setEnabled(true); sliderM.setEnabled(true); lblType.setEnabled(true); lblTypeValue.setEnabled(true); sliderType.setEnabled(true); lblMc.setEnabled(true); lblMcValue.setEnabled(true); sliderMc.setEnabled(true); model.setCurrentPhase(3); readInputs(); updateFire(); updateScrews(); updatePot(); updatePanels(); repaint(); } }); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) .addGroup(gl_panelInputs.createSequentialGroup().addGap(25) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING).addGroup(gl_panelInputs .createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addComponent(lblMo, GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE) .addComponent(lblM, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addComponent(lblType, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addComponent(lblMc, GroupLayout.PREFERRED_SIZE, 118, GroupLayout.PREFERRED_SIZE)) .addGap(18)) .addComponent(lblT, GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblMoValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblTypeValue, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addComponent(lblMcValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)) .addGap(4).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(sliderMc, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addComponent(sliderType, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addComponent(sliderM, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addComponent(sliderMo, GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE) .addComponent(sliderV, 0, 0, Short.MAX_VALUE) .addComponent(sliderT, 0, 0, Short.MAX_VALUE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(btn3, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE).addComponent(lblT) .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderT, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE).addComponent(lblV) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderV, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(lblMo) .addComponent(lblMoValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderMo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblM, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderM, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblType, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblTypeValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblMcValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblMc, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderMc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(btn1, GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE) .addGap(12)) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(btn2, GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE) .addComponent(btn3, GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE)) .addContainerGap())))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(UIManager.getColor("Button.background")); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 382, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 741, GroupLayout.PREFERRED_SIZE) .addContainerGap(31, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent( panel_visualizar, GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)) .addGroup(groupLayout.createSequentialGroup().addGap(12).addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, Short.MAX_VALUE))) .addContainerGap())); JPanel panel = new JPanel(); panel.setBounds(0, 0, 345, 568); panel.setBackground(Color.WHITE); panel.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_1 = new JPanel(); panel_1.setBounds(351, 0, 390, 568); panel_1.setBackground(Color.WHITE); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel33 = new JPanel(); panel33.setBounds(1, 38, 388, 529); panel33.setBackground(Color.WHITE); JPanel panel_5 = new JPanel(); panel_5.setBounds(1, 1, 388, 31); panel_5.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel lblGrficas = new JLabel("Gr\u00E1ficas"); lblGrficas.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel_5.add(lblGrficas); panel_visualizar.setLayout(null); JPanel panel32 = new JPanel(); panel32.setBounds(1, 38, 343, 529); panel32.setBackground(Color.WHITE); JPanel panel_4 = new JPanel(); panel_4.setBounds(1, 1, 343, 31); panel_4.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel lblSimulacion = new JLabel("Simulaci\u00F3n"); lblSimulacion.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel_4.add(lblSimulacion); panel_visualizar.add(panel); panel.setLayout(null); panel.add(panel_4); panel.add(panel32); panelPot = new JPanelGrafica(); panelPot.setBackground(Color.WHITE); GroupLayout gl_panel32 = new GroupLayout(panel32); gl_panel32.setHorizontalGroup(gl_panel32.createParallelGroup(Alignment.LEADING).addComponent(panelPot, GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)); gl_panel32.setVerticalGroup(gl_panel32.createParallelGroup(Alignment.LEADING).addComponent(panelPot, GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE)); panel32.setLayout(gl_panel32); panel_visualizar.add(panel_1); panel_1.setLayout(null); panel_1.add(panel33); panelGraficas = new JPanelGrafica(); panelGraficas.setBackground(Color.WHITE); GroupLayout gl_panel33 = new GroupLayout(panel33); gl_panel33.setHorizontalGroup(gl_panel33.createParallelGroup(Alignment.LEADING).addComponent(panelGraficas, GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)); gl_panel33.setVerticalGroup(gl_panel33.createParallelGroup(Alignment.LEADING).addComponent(panelGraficas, GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE)); panel33.setLayout(gl_panel33); panel_1.add(panel_5); getContentPane().setLayout(groupLayout); }
From source file:edu.ku.brc.ui.UIHelper.java
/** * @return a Triple containing the platform specific Focus Border, Empty Border and Focus Color */// ww w .ja va 2 s . c om public static Triple<Border, Border, Color> getFocusBorders(final Component comp) { Triple<Border, Border, Color> focusInfo = new Triple<Border, Border, Color>(); if (focusInfo.first == null) { if (UIHelper.isMacOS()) { focusInfo.first = new MacBtnBorder(); Insets fbInsets = focusInfo.first.getBorderInsets(comp); focusInfo.second = new EmptyBorder(fbInsets); } else { if (UIManager.getLookAndFeel() instanceof PlasticLookAndFeel) { focusInfo.third = PlasticLookAndFeel.getFocusColor(); } else { focusInfo.third = UIManager.getColor("Button.focus"); } if (focusInfo.third == null) // Shouldn't happen { focusInfo.third = Color.YELLOW; } focusInfo.first = new LineBorder(focusInfo.third, 1, true); focusInfo.second = new EmptyBorder(focusBorder.getBorderInsets(comp)); } } return focusInfo; }
From source file:op.tools.SYSTools.java
public static Color getTableCellBackgroundColor(boolean isSelected, int row) { Color color;/*from www . j a va 2s .com*/ Color selectionBackground = UIManager.getColor("Table.selectionBackground"); // Color selectionBackground = new Color(57,105,138); // Nimbus Background Selection Color Color alternate = UIManager.getColor("Table.alternateRowColor"); if (isSelected) { color = selectionBackground; } else { if (row % 2 == 0) { color = alternate; } else { color = Color.white; } } return color; }
From source file:org.broad.igv.cbio.FilterGeneNetworkUI.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license tabbedPane = new JTabbedPane(); dialogPane = new JPanel(); panel1 = new JPanel(); addRow = new JButton(); contentPane = new JPanel(); scrollPane1 = new JScrollPane(); geneTable = new JTable(); buttonBar = new JPanel(); totNumGenes = new JLabel(); keepIsolated = new JCheckBox(); okButton = new JButton(); refFilter = new JButton(); cancelButton = new JButton(); helpButton = new JButton(); saveButton = new JButton(); thresholds = new JPanel(); contentPanel = new JPanel(); label2 = new JLabel(); label3 = new JLabel(); delInput = new JTextField(); label4 = new JLabel(); expUpInput = new JTextField(); label7 = new JLabel(); expDownInput = new JTextField(); ampInput = new JTextField(); label1 = new JLabel(); mutInput = new JTextField(); label6 = new JLabel(); label8 = new JLabel(); separator1 = new JSeparator(); separator3 = new JSeparator(); separator2 = new JSeparator(); panel2 = new JPanel(); textArea1 = new JTextArea(); //======== this ======== setMinimumSize(new Dimension(600, 22)); setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); Container contentPane2 = getContentPane(); contentPane2.setLayout(new BorderLayout()); //======== tabbedPane ======== {/*from w w w . j av a 2 s . c o m*/ tabbedPane.setPreferredSize(new Dimension(550, 346)); tabbedPane.setMinimumSize(new Dimension(550, 346)); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { tabbedPaneStateChanged(e); } }); //======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setMinimumSize(new Dimension(443, 300)); dialogPane.setPreferredSize(new Dimension(443, 300)); dialogPane.setLayout(new GridBagLayout()); ((GridBagLayout) dialogPane.getLayout()).columnWidths = new int[] { 0, 0 }; ((GridBagLayout) dialogPane.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) dialogPane.getLayout()).columnWeights = new double[] { 1.0, 1.0E-4 }; ((GridBagLayout) dialogPane.getLayout()).rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0E-4 }; //======== panel1 ======== { panel1.setLayout(new GridBagLayout()); ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] { 0, 0, 0 }; ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] { 0, 0 }; ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] { 0.0, 0.0, 1.0E-4 }; ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] { 0.0, 1.0E-4 }; //---- addRow ---- addRow.setText("Add Filter"); addRow.setMaximumSize(new Dimension(200, 28)); addRow.setMinimumSize(new Dimension(100, 28)); addRow.setPreferredSize(new Dimension(150, 28)); addRow.setVisible(false); addRow.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addRowActionPerformed(e); } }); panel1.add(addRow, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } dialogPane.add(panel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //======== contentPane ======== { contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); } dialogPane.add(contentPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //======== scrollPane1 ======== { //---- geneTable ---- geneTable.setAutoCreateRowSorter(true); scrollPane1.setViewportView(geneTable); } dialogPane.add(scrollPane1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout()); ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 85, 85, 80 }; ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0, 0.0, 0.0 }; //---- totNumGenes ---- totNumGenes.setText("Total Genes: #"); buttonBar.add(totNumGenes, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- keepIsolated ---- keepIsolated.setText("Keep Isolated Genes"); keepIsolated.setVisible(false); buttonBar.add(keepIsolated, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- okButton ---- okButton.setText("View Network"); okButton.setToolTipText("Display the network in a web browser"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okButtonActionPerformed(e); } }); buttonBar.add(okButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); //---- refFilter ---- refFilter.setText("Refresh Filter"); refFilter.setVisible(false); refFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { refFilterActionPerformed(e); } }); buttonBar.add(refFilter, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- cancelButton ---- cancelButton.setText("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(e); } }); buttonBar.add(cancelButton, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- helpButton ---- helpButton.setText("Help"); helpButton.setVisible(false); buttonBar.add(helpButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- saveButton ---- saveButton.setText("Save Table"); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveButtonActionPerformed(e); } }); buttonBar.add(saveButton, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); } dialogPane.add(buttonBar, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } tabbedPane.addTab("Filter", dialogPane); //======== thresholds ======== { thresholds.setPreferredSize(new Dimension(550, 196)); thresholds.setMinimumSize(new Dimension(550, 196)); thresholds.setLayout(null); //======== contentPanel ======== { contentPanel.setBorder(new EtchedBorder()); contentPanel.setLayout(null); //---- label2 ---- label2.setText("Amplification:"); label2.setHorizontalAlignment(SwingConstants.RIGHT); label2.setLabelFor(ampInput); label2.setToolTipText("Amplification score, on a log-normalized scale"); label2.setPreferredSize(new Dimension(90, 18)); contentPanel.add(label2); label2.setBounds(140, 96, label2.getPreferredSize().width, 18); //---- label3 ---- label3.setText("Deletion:"); label3.setHorizontalAlignment(SwingConstants.RIGHT); label3.setLabelFor(delInput); label3.setToolTipText("Deletion score, on a log-normalized scale"); label3.setPreferredSize(new Dimension(60, 16)); contentPanel.add(label3); label3.setBounds(360, 96, label3.getPreferredSize().width, 18); //---- delInput ---- delInput.setText("0.7"); delInput.setMinimumSize(new Dimension(34, 28)); delInput.setPreferredSize(new Dimension(45, 28)); delInput.setMaximumSize(new Dimension(50, 2147483647)); contentPanel.add(delInput); delInput.setBounds(new Rectangle(new Point(240, 162), delInput.getPreferredSize())); //---- label4 ---- label4.setText("Up:"); label4.setHorizontalAlignment(SwingConstants.RIGHT); label4.setLabelFor(expUpInput); label4.setToolTipText("Expression score, log-normalized scale"); label4.setPreferredSize(new Dimension(100, 18)); contentPanel.add(label4); label4.setBounds(130, 168, label4.getPreferredSize().width, 18); //---- expUpInput ---- expUpInput.setText("0.1"); expUpInput.setMinimumSize(new Dimension(34, 28)); expUpInput.setPreferredSize(new Dimension(45, 28)); contentPanel.add(expUpInput); expUpInput.setBounds(new Rectangle(new Point(430, 91), expUpInput.getPreferredSize())); //---- label7 ---- label7.setText("Down:"); label7.setHorizontalAlignment(SwingConstants.RIGHT); label7.setLabelFor(expDownInput); label7.setToolTipText("Expression score, log-normalized scale"); label7.setPreferredSize(new Dimension(120, 16)); contentPanel.add(label7); label7.setBounds(300, 168, label7.getPreferredSize().width, 18); //---- expDownInput ---- expDownInput.setText("0.1"); expDownInput.setPreferredSize(new Dimension(45, 28)); expDownInput.setMinimumSize(new Dimension(34, 28)); expDownInput.setMaximumSize(new Dimension(50, 2147483647)); contentPanel.add(expDownInput); expDownInput.setBounds(new Rectangle(new Point(430, 162), expDownInput.getPreferredSize())); //---- ampInput ---- ampInput.setText("0.7"); ampInput.setMinimumSize(new Dimension(34, 28)); ampInput.setPreferredSize(new Dimension(45, 28)); contentPanel.add(ampInput); ampInput.setBounds(new Rectangle(new Point(240, 91), ampInput.getPreferredSize())); //---- label1 ---- label1.setText("Mutation:"); label1.setHorizontalAlignment(SwingConstants.RIGHT); label1.setLabelFor(mutInput); label1.setToolTipText("Minimum number of mutations found"); label1.setPreferredSize(new Dimension(66, 18)); contentPanel.add(label1); label1.setBounds(50, 26, label1.getPreferredSize().width, 18); //---- mutInput ---- mutInput.setText("1"); mutInput.setAutoscrolls(false); mutInput.setMinimumSize(new Dimension(34, 28)); mutInput.setPreferredSize(new Dimension(45, 28)); contentPanel.add(mutInput); mutInput.setBounds(new Rectangle(new Point(240, 21), mutInput.getPreferredSize())); //---- label6 ---- label6.setText("Copy Number:"); contentPanel.add(label6); label6.setBounds(30, 96, label6.getPreferredSize().width, 18); //---- label8 ---- label8.setText("Expression:"); label8.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(label8); label8.setBounds(30, 168, 86, 18); contentPanel.add(separator1); separator1.setBounds(0, 135, 500, 10); contentPanel.add(separator3); separator3.setBounds(0, 65, 500, 10); //---- separator2 ---- separator2.setPreferredSize(new Dimension(10, 210)); separator2.setOrientation(SwingConstants.VERTICAL); contentPanel.add(separator2); separator2.setBounds(new Rectangle(new Point(120, 0), separator2.getPreferredSize())); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < contentPanel.getComponentCount(); i++) { Rectangle bounds = contentPanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPanel.setMinimumSize(preferredSize); contentPanel.setPreferredSize(preferredSize); } } thresholds.add(contentPanel); contentPanel.setBounds(12, 80, 500, 210); //======== panel2 ======== { panel2.setLayout(null); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panel2.getComponentCount(); i++) { Rectangle bounds = panel2.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panel2.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel2.setMinimumSize(preferredSize); panel2.setPreferredSize(preferredSize); } } thresholds.add(panel2); panel2.setBounds(new Rectangle(new Point(55, 25), panel2.getPreferredSize())); //---- textArea1 ---- textArea1.setText( "Samples are considered to have a given \"event\" if the value is above the thresholds below."); textArea1.setEditable(false); textArea1.setLineWrap(true); textArea1.setBackground(UIManager.getColor("Button.background")); thresholds.add(textArea1); textArea1.setBounds(15, 10, 430, 40); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < thresholds.getComponentCount(); i++) { Rectangle bounds = thresholds.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = thresholds.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; thresholds.setMinimumSize(preferredSize); thresholds.setPreferredSize(preferredSize); } } tabbedPane.addTab("Thresholds", thresholds); } contentPane2.add(tabbedPane, BorderLayout.NORTH); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:org.freeplane.main.application.MapViewDockingWindows.java
public MapViewDockingWindows() { viewSerializer = new MapViewSerializer(); rootWindow = new RootWindow(viewSerializer); RootWindowProperties rootWindowProperties = rootWindow.getRootWindowProperties(); rootWindowProperties.addSuperObject(new BlueHighlightDockingTheme().getRootWindowProperties()); rootWindowProperties.getWindowAreaProperties().setBackgroundColor(UIManager.getColor("Panel.background")); rootWindow.getWindowBar(Direction.DOWN).setEnabled(true); try {/*from ww w . jav a2s . co m*/ ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); ObjectOutputStream wrapper = new ObjectOutputStream(byteStream); rootWindow.write(wrapper); wrapper.close(); emptyConfigurations = byteStream.toByteArray(); } catch (IOException e1) { } removeDesktopPaneAccelerators(); mapViews = new Vector<Component>(); final FileOpener fileOpener = new FileOpener(); new DropTarget(rootWindow, fileOpener); rootWindow.addMouseListener(new DefaultMapMouseListener()); final Controller controller = Controller.getCurrentController(); controller.getMapViewManager().addMapViewChangeListener(this); rootWindow.addListener(new DockingWindowAdapter() { @Override public void viewFocusChanged(View previouslyFocusedView, View focusedView) { if (previouslyFocusedView != null && focusedView != null) { Component containedMapView = getContainedMapView(focusedView); viewSelectionChanged(containedMapView); } } @Override public void windowClosing(DockingWindow window) throws OperationAbortedException { for (Component mapViewComponent : mapViews.toArray(new Component[] {})) if (SwingUtilities.isDescendingFrom(mapViewComponent, window)) if (!Controller.getCurrentController().getMapViewManager().close(mapViewComponent, false)) throw new OperationAbortedException("can not close view"); } @Override public void windowAdded(final DockingWindow addedToWindow, final DockingWindow addedWindow) { if (addedWindow instanceof TabWindow) { final DockingWindowProperties windowProperties = addedWindow.getWindowProperties(); windowProperties.setDockEnabled(false); windowProperties.setUndockEnabled(false); final TabAreaProperties tabAreaProperties = ((TabWindow) addedWindow).getTabWindowProperties() .getTabbedPanelProperties().getTabAreaProperties(); if (addedToWindow == rootWindow) tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.MORE_THAN_ONE_TAB); else tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.ALWAYS); } setTabPolicies(addedWindow); } private void setTabPolicies(final DockingWindow window) { if (window instanceof TabWindow) { TabbedPanelProperties tabbedPanelProperties = ((TabWindow) window).getTabWindowProperties() .getTabbedPanelProperties(); if (!tabbedPanelProperties.getTabLayoutPolicy().equals(TabLayoutPolicy.COMPRESSION)) tabbedPanelProperties.setTabLayoutPolicy(TabLayoutPolicy.COMPRESSION); if (!tabbedPanelProperties.getTabDropDownListVisiblePolicy() .equals(TabDropDownListVisiblePolicy.MORE_THAN_ONE_TAB)) tabbedPanelProperties .setTabDropDownListVisiblePolicy(TabDropDownListVisiblePolicy.MORE_THAN_ONE_TAB); } for (int i = 0; i < window.getChildWindowCount(); i++) { setTabPolicies(window.getChildWindow(i)); } } @Override public void windowRemoved(DockingWindow removedFromWindow, DockingWindow removedWindow) { if (removedWindow instanceof TabWindow) { if (removedFromWindow == rootWindow) { final TabAreaProperties tabAreaProperties = ((TabWindow) removedWindow) .getTabWindowProperties().getTabbedPanelProperties().getTabAreaProperties(); tabAreaProperties.setTabAreaVisiblePolicy(TabAreaVisiblePolicy.ALWAYS); } } } }); new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { } }; }
From source file:org.kepler.gui.kar.ImportModuleDependenciesAction.java
/** Check the dependencies and ask the user how to proceed. */ public ImportChoice checkDependencies() { ConfigurationManager cman = ConfigurationManager.getInstance(); ConfigurationProperty cprop = cman.getProperty(KARFile.KARFILE_CONFIG_PROP_MODULE); ConfigurationProperty KARComplianceProp = cprop.getProperty(KARFile.KAR_COMPLIANCE_PROPERTY_NAME); String KARCompliance = KARComplianceProp.getValue(); final ArrayList<String> dependencies = new ArrayList<String>(); try {/*from w w w .ja v a2 s. c om*/ if (_dependencies != null) { // dependencies were given dependencies.addAll(_dependencies); } else if (_archiveFile != null) { // kar file was given KARFile karFile = null; try { karFile = new KARFile(_archiveFile); dependencies.addAll(karFile.getModuleDependencies()); } finally { if (karFile != null) { karFile.close(); } } } else { // karxml was given dependencies.addAll(_karXml.getModuleDependencies()); } } catch (Exception ex) { ex.printStackTrace(); } //ModuleTree moduleTree = ModuleTree.instance(); //String currentModList = formattedCurrentModuleList(moduleTree); boolean dependencyMissingFullVersion = !(ModuleDependencyUtil .isDependencyVersioningInfoComplete(dependencies)); LinkedHashMap<String, Version> unsatisfiedDependencies = ModuleDependencyUtil .getUnsatisfiedDependencies(dependencies); String keplerRestartMessage = null; String unableToOpenOrExportInStrictKARComplianceMessage = null; String manualActionRequired = null; String unSats = formattedUnsatisfiedDependencies(unsatisfiedDependencies); final List<String> unSatsAsList = new ArrayList<String>(unsatisfiedDependencies.keySet()); String formattedDependencies = formatDependencies(dependencies); String htmlBGColor = "#" + Integer.toHexString(UIManager.getColor("OptionPane.background").getRGB() & 0x00ffffff); //XXX augment if additional strictness levels added if (KARCompliance.equals(KARFile.KAR_COMPLIANCE_STRICT)) { if (dependencyMissingFullVersion) { if (_exportMode) { unableToOpenOrExportInStrictKARComplianceMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR " + "lacks complete versioning information in its module-dependency list:<strong>" + formattedDependencies + "</strong><br><br>You must change your KAR opening compliance " + "preference to Relaxed before trying to export this KAR.<br><br>" + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>"; } else { unableToOpenOrExportInStrictKARComplianceMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR " + "lacks complete versioning information in its module-dependency list:<strong>" + formattedDependencies + "</strong><br><br>You must change your KAR opening compliance " + "preference to Relaxed before trying to open this KAR.<br><br>" + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>"; } } else { if (!unsatisfiedDependencies.isEmpty()) { if (_exportMode) { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">Your KAR opening compliance preference is set to Strict. To export this KAR in<br>" + "Strict mode you must restart Kepler with these additional module(s):<strong>" + unSats + "</strong><br><br>Would you like to download (if necessary) and restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>" + "(re-enable using the Tools=>Module Manager...)</strong><br><br>" + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>"; } else { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">Your KAR opening compliance preference is set to Strict. To open this KAR in<br>" + "Strict mode you must restart Kepler with these additional module(s):<strong>" + unSats + "</strong><br><br>Would you like to download (if necessary) and restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>" + "(re-enable using the Tools=>Module Manager...)</strong><br><br>" + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>"; } } else { if (_exportMode) { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">Your KAR opening compliance preference is set to Strict. To export this KAR in<br>" + "Strict mode you must restart Kepler using this module set in this order:<strong>" + formattedDependencies + "</strong><br><br>Would you like to restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>" + "(re-enable using the Tools=>Module Manager...)</strong><br><br>" + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>"; } else { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">Your KAR opening compliance preference is set to Strict. To open this KAR in<br>" + "Strict mode you must restart Kepler using this module set in this order:<strong>" + formattedDependencies + "</strong><br><br>Would you like to restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost, and auto-updating turned off if it's on<br>" + "(re-enable using the Tools=>Module Manager...)</strong><br><br>" + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>"; } } } } else if (KARCompliance.equals(KARFile.KAR_COMPLIANCE_RELAXED)) { if (dependencyMissingFullVersion) { // if there's a dependency missing full version info, situation should be either 1) a 2.0 kar, in which case // it lacks the full mod dep list and so user must use MM, or 2) it's a 2.1 kar created from an svn // checkout of kepler, in which case, the power user should use the build system to // change to unreleased versions of a suite containing the required modules as necessary if (_exportMode) { manualActionRequired = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR " + "requires the following unsatisfied module dependencies that lack complete versioning information:<strong>" + unSats + "</strong><br><br>Please use the Module Manager or build system to change to a suite that uses these modules.</strong>" + "<br><br>You can Force Export, but some artifacts may not be included in the KAR.</body></html>"; } else { manualActionRequired = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR " + "requires the following unsatisfied module dependencies that lack complete versioning information:<strong>" + unSats + "</strong><br><br>Please use the Module Manager or build system to change to a suite that uses these modules.</strong>" + "<br><br>You can attempt a Force Open, but this may cause unexpected errors.</body></html>"; } } else { if (!unsatisfiedDependencies.isEmpty()) { if (_exportMode) { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR requires you restart Kepler with these " + "additional module(s):<strong>" + unSats + "</strong><br><br>Would you like to " + "download (if necessary) and restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>" + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>"; } else { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR requires you restart Kepler with these " + "additional module(s):<strong>" + unSats + "</strong><br><br>Would you like to " + "download (if necessary) and restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>" + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>"; } } else { //THIS SHOULDN'T HAPPEN log.error( "ImportModuleDependenciesAction WARNING unsatisfiedDependencies is empty, this shouldn't happen, but is non fatal"); if (_exportMode) { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR requires you restart Kepler with these " + "module(s):<strong>" + formattedDependencies + "</strong><br><br>Would you like to " + "restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>" + "You can Force Export, but some artifacts may not be included in the KAR.</body></html>"; } else { keplerRestartMessage = "<html><body bgcolor=\"" + htmlBGColor + "\">This KAR requires you restart Kepler with these " + "module(s):<strong>" + formattedDependencies + "</strong><br><br>Would you like to " + "restart Kepler using these modules now?" + "<br><br><strong>WARNING: All unsaved work will be lost</strong><br><br>" + "You can attempt a Force Open, but this may cause unexpected errors.</body></html>"; } } } } String[] optionsOkForceopen = { "OK", "Force Open" }; String[] optionsOkForceexport = { "OK", "Force Export" }; String[] optionsYesNoForceopen = { "Yes", "No", "Force Open" }; String[] optionsYesNoForceexport = { "Yes", "No", "Force Export" }; if (unableToOpenOrExportInStrictKARComplianceMessage != null) { JLabel label = new JLabel(unableToOpenOrExportInStrictKARComplianceMessage); if (_exportMode) { int choice = JOptionPane.showOptionDialog(parent, label, "Unable to export in Strict mode", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceexport, optionsOkForceexport[0]); if (optionsOkForceexport[choice].equals("Force Export")) { return ImportChoice.FORCE_EXPORT; } } else { int choice = JOptionPane.showOptionDialog(parent, label, "Unable to open in Strict mode", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceopen, optionsOkForceopen[0]); if (optionsOkForceopen[choice].equals("Force Open")) { return ImportChoice.FORCE_OPEN; } } return ImportChoice.DO_NOTHING; } if (manualActionRequired != null) { JLabel label = new JLabel(manualActionRequired); if (_exportMode) { int choice = JOptionPane.showOptionDialog(parent, label, "Use Module Manager", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceexport, optionsOkForceexport[0]); if (optionsOkForceexport[choice].equals("Force Export")) { return ImportChoice.FORCE_EXPORT; } } else { int choice = JOptionPane.showOptionDialog(parent, label, "Use Module Manager", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsOkForceopen, optionsOkForceopen[0]); if (optionsOkForceopen[choice].equals("Force Open")) { return ImportChoice.FORCE_OPEN; } } return ImportChoice.DO_NOTHING; } JLabel label = new JLabel(keplerRestartMessage); if (_exportMode) { int choice = JOptionPane.showOptionDialog(parent, label, "Confirm Kepler Restart", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsYesNoForceexport, optionsYesNoForceexport[1]); if (optionsYesNoForceexport[choice] == "No") { // user doesn't want to download. return ImportChoice.DO_NOTHING; } else if (optionsYesNoForceexport[choice].equals("Force Export")) { return ImportChoice.FORCE_EXPORT; } } else { int choice = JOptionPane.showOptionDialog(parent, label, "Confirm Kepler Restart", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, optionsYesNoForceopen, optionsYesNoForceopen[1]); if (optionsYesNoForceopen[choice] == "No") { // user doesn't want to download. return ImportChoice.DO_NOTHING; } else if (optionsYesNoForceopen[choice].equals("Force Open")) { return ImportChoice.FORCE_OPEN; } } parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { @Override public Void doInBackground() throws Exception { try { //download needed modules ModuleDownloader downloader = new ModuleDownloader(); ModuleDownloadProgressMonitor mdpm = new ModuleDownloadProgressMonitor(parent); downloader.addListener(mdpm); if (!unSatsAsList.isEmpty()) { downloader.downloadModules(unSatsAsList); } else { // this shouldn't happen, but if it does, resorting // to downloading all dependencies should be a safe bet log.error("ImportModuleDependenciesAction WARNING unSatsAsList is empty, " + "this shouldn't happen, but is non fatal"); downloader.downloadModules(dependencies); } //rewrite modules.txt ModulesTxt modulesTxt = ModulesTxt.instance(); modulesTxt.clear(); for (String dependency : dependencies) { //System.out.println("ImportModuleDependency doInBackground modulesTxt.add("+dependency+")"); modulesTxt.add(dependency); } modulesTxt.write(); //delete and write "unknown" to current-suite.txt CurrentSuiteTxt.delete(); CurrentSuiteTxt.setName("unknown"); // if KARCompliance is Strict, user is restarting w/ specific versions of modules // and we don't want them to potentially auto update on restart to available patches turnOffAutoUpdatesIfStrictMode(); //restart Kepler using new modules spawnNewKeplerAndQuitCurrent(); return null; } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(parent, "Error downloading module: " + ex.getMessage()); return null; } } @Override protected void done() { //never reached. } }; worker.execute(); parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); return ImportChoice.DOWNLOADING_AND_RESTARTING; }
From source file:org.springframework.richclient.application.statusbar.support.DefaultStatusBar.java
/** * Create the <code>JLabel</code> used to render the messages. * <p>//from ww w. j a v a 2 s . c o m * Can safely be overridden to customize the label * * @return the <code>JLabel</code> */ protected JLabel createMessageLabel() { JLabel messageLabel = new JLabel(" "); messageLabel.setName("message"); Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, UIManager.getColor("controlHighlight"), UIManager.getColor("controlShadow")); Border emptyBorder = BorderFactory.createEmptyBorder(1, 3, 1, 3); messageLabel.setBorder(BorderFactory.createCompoundBorder(bevelBorder, emptyBorder)); return messageLabel; }