Java Code Examples for javax.swing.JPanel#setMinimumSize()

The following examples show how to use javax.swing.JPanel#setMinimumSize() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(6, 1, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setMinimumSize(new Dimension(500, 180));
    final JLabel label1 = new JLabel();
    label1.setText("Directory Name:");
    contentPanel.add(label1, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    directoryName = new JTextField();
    contentPanel.add(directoryName, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setText("Repository Url:");
    contentPanel.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    repoUrl = new JTextField();
    repoUrl.setEditable(false);
    contentPanel.add(repoUrl, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, -1), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("Parent Directory:");
    contentPanel.add(label3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
 
Example 2
protected Container createDefaultContentPane()
{

  demoContent = new JPanel();
  demoContent.setLayout(new BorderLayout());
  demoContent.setMinimumSize(new Dimension(100, 100));
  demoContent.add(getNoHandlerInfoPane(), BorderLayout.CENTER);

  JPanel placeHolder = new JPanel();
  placeHolder.setMinimumSize(new Dimension(300, 0));
  placeHolder.setPreferredSize(new Dimension(300, 0));
  placeHolder.setMaximumSize(new Dimension(300, 0));

  JPanel rootContent = new JPanel();
  rootContent.setLayout(new BorderLayout());
  rootContent.add(demoContent, BorderLayout.CENTER);
  rootContent.add(placeHolder, BorderLayout.NORTH);

  final DemoSelectorTreeNode root = new DemoSelectorTreeNode(null,
      demoSelector);
  final DefaultTreeModel model = new DefaultTreeModel(root);
  final JTree demoTree = new JTree(model);
  demoTree.addTreeSelectionListener(new TreeSelectionHandler());

  JSplitPane rootSplitPane =
      new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
          new JScrollPane(demoTree), rootContent);
  rootSplitPane.setContinuousLayout(true);
  rootSplitPane.setDividerLocation(200);
  rootSplitPane.setOneTouchExpandable(true);
  return rootSplitPane;
}
 
Example 3
Source Project: ghidra   File: InsertBytesWidget.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the visual components for this dialog.
 * 
 * @return the new panel
 */
protected JPanel createWorkPanel() {

	JPanel contentPanel = new JPanel();
	contentPanel.setMinimumSize(new Dimension(500, 300));

	// Create the input text widget and give it a scrollbar.
	inputBytesTA = new HintTextAreaIS(HINT_TEXT);
	JScrollPane scrollPane = new JScrollPane(inputBytesTA);
	inputBytesTA.addKeyListener(this);

	selectionModeWidget = new SelectionModeWidget("Input Mode", this);
	endianFlipWidget = new EndianFlipWidget("Endianness", this);
	msgPanel = new MessagePanel();

	JPanel southPanel = new JPanel();
	southPanel.setLayout(new BorderLayout());
	southPanel.add(selectionModeWidget, BorderLayout.WEST);
	southPanel.add(endianFlipWidget, BorderLayout.CENTER);
	southPanel.add(msgPanel, BorderLayout.SOUTH);

	// Use a border layout so we can put the text area in the CENTER location and have it
	// grow automatically as the panel is resized.
	contentPanel.setLayout(new BorderLayout());
	contentPanel.add(scrollPane, BorderLayout.CENTER);
	contentPanel.add(southPanel, BorderLayout.SOUTH);

	return contentPanel;
}
 
Example 4
private JPanel getCardDetailsPanel() {
    final JPanel panel = new JPanel();
    panel.setMinimumSize(new Dimension());
    panel.setOpaque(false);
    panel.setLayout(new MigLayout("insets 0"));
    panel.add(cardViewer, "w 100%, h 0:100%");
    return panel;
}
 
Example 5
private JPanel createMosaicBoundsPanel() {
    final TableLayout layout = new TableLayout(1);
    layout.setTableAnchor(TableLayout.Anchor.WEST);
    layout.setTableFill(TableLayout.Fill.BOTH);
    layout.setTableWeightX(1.0);
    layout.setTableWeightY(0.0);
    layout.setRowWeightY(1, 1.0);
    layout.setRowAnchor(2, TableLayout.Anchor.EAST);
    layout.setRowFill(2, TableLayout.Fill.NONE);
    layout.setTablePadding(3, 3);
    final JPanel panel = new JPanel(layout);
    panel.setBorder(BorderFactory.createTitledBorder("Mosaic Bounds"));
    final WorldMapPaneDataModel worldMapModel = mosaicModel.getWorldMapModel();
    setMapBoundary(worldMapModel);

    final JPanel worldMapPanel = new RegionSelectableWorldMapPane(worldMapModel, bindingCtx).createUI();
    bindingCtx.addPropertyChangeListener(new MapBoundsChangeListener());
    worldMapPanel.setMinimumSize(new Dimension(250, 125));
    worldMapPanel.setBorder(BorderFactory.createEtchedBorder());

    final JCheckBox showSourceProductsCheckBox = new JCheckBox("Display source products");
    bindingCtx.bind(MosaicFormModel.PROPERTY_SHOW_SOURCE_PRODUCTS, showSourceProductsCheckBox);

    boundsInputPanel = new BoundsInputPanel(bindingCtx, MosaicFormModel.PROPERTY_UPDATE_MODE);

    panel.add(boundsInputPanel.createBoundsInputPanel(true));
    panel.add(worldMapPanel);
    panel.add(showSourceProductsCheckBox);

    return panel;
}
 
Example 6
Source Project: jsyn   File: ScopeProbePanel.java    License: Apache License 2.0 5 votes vote down vote up
public ScopeProbePanel(AudioScopeProbeView probeView) {
    this.audioScopeProbeView = probeView;
    setLayout(new BorderLayout());

    setBorder(BorderFactory.createLineBorder(Color.GRAY, 3));

    // Add a colored box to match the waveform color.
    JPanel colorPanel = new JPanel();
    colorPanel.setMinimumSize(new Dimension(40, 40));
    audioScopeProbe = probeView.getModel();
    colorPanel.setBackground(audioScopeProbe.getColor());
    add(colorPanel, BorderLayout.NORTH);

    // Knob for tweaking vertical range.
    verticalScaleKnob = new RotaryTextController(audioScopeProbeView.getWaveTraceView()
            .getVerticalRangeModel(), 5);
    add(verticalScaleKnob, BorderLayout.CENTER);
    verticalScaleKnob.setTitle("YScale");

    // Auto ranging checkbox.
    autoBox = new JCheckBox("Auto");
    autoScaleModel = audioScopeProbeView.getWaveTraceView().getAutoButtonModel();
    autoScaleModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ToggleButtonModel model = (ToggleButtonModel) e.getSource();
            boolean enabled = !model.isSelected();
            System.out.println("Knob enabled = " + enabled);
            verticalScaleKnob.setEnabled(!model.isSelected());
        }
    });
    autoBox.setModel(autoScaleModel);
    add(autoBox, BorderLayout.SOUTH);

    verticalScaleKnob.setEnabled(!autoScaleModel.isSelected());

    setMinimumSize(new Dimension(80, 100));
    setPreferredSize(new Dimension(80, 150));
    setMaximumSize(new Dimension(120, 200));
}
 
Example 7
private Splitter prepareSplitter(DataSourceListPanel dataSourceListPanel,
                                 JPanel dataSourcesConfigurationPanel) {
    Splitter splitter = new Splitter(false, 0.3f);
    splitter.setFirstComponent(dataSourceListPanel);
    splitter.setSecondComponent(dataSourcesConfigurationPanel);
    dataSourcesConfigurationPanel.setMinimumSize(new Dimension(300, 400));
    return splitter;
}
 
Example 8
public void addTask(JPanelReporting jPanelReporting)
{
    list.add(jPanelReporting);
    
    jPanel1.removeAll();
    
    GridBagConstraints gridBagConstraintsTest = new GridBagConstraints();
    gridBagConstraintsTest.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraintsTest.gridx = 0;
    gridBagConstraintsTest.gridwidth = 1;
    gridBagConstraintsTest.weightx = 1;

    for(JPanelReporting aJPanelReporting: list)
    {
        jPanel1.add(aJPanelReporting, gridBagConstraintsTest);
    }
    
    
    GridBagConstraints gridBagConstraintsPadding = new GridBagConstraints();
    gridBagConstraintsPadding.fill = GridBagConstraints.VERTICAL;
    gridBagConstraintsPadding.gridx = 0;
    gridBagConstraintsPadding.gridwidth = 1;
    gridBagConstraintsPadding.weighty = 1;

    JPanel jPanel = new JPanel();
    jPanel.setMinimumSize(new Dimension(0, 0));
    jPanel.setPreferredSize(new Dimension(0, 0));
    
    jPanel1.add(jPanel, gridBagConstraintsPadding);
    this.jPanel1.revalidate();
}
 
Example 9
public void addJPanelGeneric (JPanelGeneric jPanelGeneric){
    if(null != jPanelGeneric){
       
        GridBagConstraints gridBagConstraintsTest = new GridBagConstraints();
        gridBagConstraintsTest.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsTest.gridx = 0;
        gridBagConstraintsTest.gridwidth = 1;
        gridBagConstraintsTest.weightx = 1;

        this.listOfPanelGeneric.add(jPanelGeneric);
        this.add(jPanelGeneric, gridBagConstraintsTest);
        this.validate();
        jPanelGeneric.init();
    }
    else{
        GridBagConstraints gridBagConstraintsPadding = new GridBagConstraints();
        gridBagConstraintsPadding.fill = GridBagConstraints.VERTICAL;
        gridBagConstraintsPadding.gridx = 0;
        gridBagConstraintsPadding.gridwidth = 1;
        gridBagConstraintsPadding.weighty = 1;

        JPanel jPanel = new JPanel();
        jPanel.setMinimumSize(new Dimension(0, 0));
        jPanel.setPreferredSize(new Dimension(0, 0));

        this.add(jPanel, gridBagConstraintsPadding);
        this.validate();
    }
}
 
Example 10
ExperimentTab() {
	setLayout(new BorderLayout(0, 0));
	
	topPanel = new JPanel();
	topPanel.setMinimumSize(new Dimension(34, 250));
	add(topPanel, BorderLayout.NORTH);
	topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
	
	bottomPanel = new JPanel();
	add(bottomPanel, BorderLayout.SOUTH);
	bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
}
 
Example 11
Source Project: binnavi   File: CProjectNodeComponent.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the elements of this component.
 */
private void createGui() {
  final JPanel topPanel = new JPanel(new BorderLayout());
  final JPanel innerTopPanel = new JPanel(new BorderLayout());
  innerTopPanel.add(m_stdEditPanel);
  topPanel.add(innerTopPanel);
  final JPanel debuggerChooserPanel = new JPanel(new BorderLayout());
  debuggerChooserPanel.setBorder(new TitledBorder("Project Debuggers"));
  m_checkedList = new JCheckedListbox<>(new Vector<DebuggerTemplate>(), false);
  updateCheckedListPanel();
  final JScrollPane debuggerScrollPane = new JScrollPane(m_checkedList);
  m_checkedListPanel.add(debuggerScrollPane);
  debuggerChooserPanel.add(m_checkedListPanel, BorderLayout.CENTER);
  debuggerChooserPanel.setMinimumSize(new Dimension(0, 128));
  debuggerChooserPanel.setPreferredSize(new Dimension(0, 128));
  innerTopPanel.add(debuggerChooserPanel, BorderLayout.SOUTH);
  final JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
  buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 2));
  buttonPanel.add(new JPanel());
  buttonPanel.add(m_saveButton);
  topPanel.add(buttonPanel, BorderLayout.SOUTH);
  final JPanel bottomPanel = new CAddressSpacesTablePanel(m_table);
  final JScrollPane scrollPane = new JScrollPane(m_table);
  bottomPanel.setBorder(m_titledBorder);
  setBorder(new EmptyBorder(0, 0, 0, 1));
  bottomPanel.add(scrollPane);
  final JSplitPane splitPane =
      new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topPanel, bottomPanel);
  splitPane.setOneTouchExpandable(true);
  splitPane.setDividerLocation(splitPane.getMinimumDividerLocation());
  splitPane.setResizeWeight(0.5);
  add(splitPane);
}
 
Example 12
private JPanel createRomanNumberPanel() {
    JPanel romanPanel = new JPanel();
    romanPanel.setPreferredSize(new Dimension(150, 150));
    romanPanel.setMinimumSize(new Dimension(150, 150));
    return romanPanel;
}
 
Example 13
@Override
protected JPanel createVariablesPanel() {
    JPanel variablesBorderPanel = new JPanel();
    BoxLayout layout = new BoxLayout(variablesBorderPanel, BoxLayout.PAGE_AXIS);
    variablesBorderPanel.setLayout(layout);

    AbstractButton addVariableButton =
            ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addVariableButton.setText(Bundle.CTL_Button_Add_Variable_Text());
    addVariableButton.setMaximumSize(new Dimension(150, controlHeight));
    addVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT);

    AbstractButton addDependentVariableButton =
            ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addDependentVariableButton.setText(Bundle.CTL_Button_Add_PDVariable_Text());
    addDependentVariableButton.setMaximumSize(new Dimension(250, controlHeight));
    addDependentVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT);

    JPanel buttonsPannel = new JPanel(new SpringLayout());
    buttonsPannel.add(addVariableButton);
    buttonsPannel.add(addDependentVariableButton);
    SpringUtilities.makeCompactGrid(buttonsPannel, 1, 2, 0, 0, 0, 0);
    buttonsPannel.setAlignmentX(Component.LEFT_ALIGNMENT);
    variablesBorderPanel.add(buttonsPannel);

    varTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    varTable.setRowHeight(controlHeight);
    int widths[] = {controlHeight, 3 * controlHeight, 10 * controlHeight};
    for (int i = 0; i < widths.length; i++) {
        TableColumn column = varTable.getColumnModel().getColumn(i);
        column.setPreferredWidth(widths[i]);
        column.setWidth(widths[i]);

    }
    JScrollPane scrollPane = new JScrollPane(varTable);
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    variablesBorderPanel.add(scrollPane);
    variablesBorderPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    Dimension variablesPanelDimension =
            new Dimension((formWidth - 3 * DEFAULT_PADDING) / 2 - 2 * DEFAULT_PADDING, 130);
    variablesBorderPanel.setMinimumSize(variablesPanelDimension);
    variablesBorderPanel.setMaximumSize(variablesPanelDimension);
    variablesBorderPanel.setPreferredSize(variablesPanelDimension);

    addVariableButton.addActionListener(e -> {
        newOperatorDescriptor.getVariables().add(new SystemVariable("key", ""));
        varTable.revalidate();
    });

    addDependentVariableButton.addActionListener(e -> {
        newOperatorDescriptor.getVariables().add(new SystemDependentVariable("key", ""));
        varTable.revalidate();
    });

    return variablesBorderPanel;
}
 
Example 14
Source Project: chipster   File: VisualisationFrame.java    License: MIT License 4 votes vote down vote up
public JComponent createVisualisation(VisualisationMethodChangedEvent e) {
	
	JComponent componentToReturn = null;

	try {
		// Create new visualiser only if needed to keep the settings made in settings panel
		if (this.datas != e.getDatas() || this.method != e.getNewMethod()) {
			this.datas = e.getDatas();
			this.method = e.getNewMethod();

			removeVisualiser();
			visualiser = method.getVisualiser(this);
		}
		this.variables = e.getVariables();

		// parameter panel has to be first one to make it initialised before the
		// data is set (scatterplot)
		JPanel parametersPanel = visualiser.getParameterPanel();
		logger.debug("parametersPanel for method " + method + " contains: " + parametersPanel);
		if (parametersPanel != null) {
			paramSplit = new JSplitPane();
			parametersPanel.setMinimumSize(new Dimension(0, 0));
			paramSplit.setRightComponent(parametersPanel);
			// To show the width limit of parameter panel
			paramSplit.setContinuousLayout(true);
			// To keep the parameter panel size constant
			paramSplit.setResizeWeight(1.0);

			SplitSizeHandler sizeHandler = new SplitSizeHandler();
			paramSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, sizeHandler);
		} else {
			//Do not keep references to old visualization to avoid memory leak
			if (paramSplit != null) {
				paramSplit.removeAll();
			}
		}

		JComponent visualisationComponent = null;


		if (visualiser.isForMultipleDatas()) {
			visualisationComponent = visualiser.getVisualisation(datas);
		} else if (visualiser.isForSingleData()) {
			DataBean data = datas.size() > 0 ? datas.get(0) : null;
			visualisationComponent = visualiser.getVisualisation(data);
		}

		if (parametersPanel != null) {
			paramSplit.setLeftComponent(visualisationComponent);
			componentToReturn = paramSplit;
		} else {
			componentToReturn = visualisationComponent;
		}
		
	} catch (Exception e1) {
		application.reportException(e1);
		componentToReturn = visualiser.getDefaultVisualisation();
	}

	return componentToReturn;
}
 
Example 15
Source Project: littleluck   File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
protected JComponent createMainPanel() {
    
    // Create main panel with demo selection on left and demo/source on right
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
   
    // Create demo selector panel on left
    demoSelectorPanel = new DemoSelectorPanel(demoListTitle, demoList);
    demoSelectorPanel.setPreferredSize(new Dimension(DEMO_SELECTOR_WIDTH, MAIN_FRAME_HEIGHT));
    demoSelectorPanel.addPropertyChangeListener(new DemoSelectionListener());
    mainPanel.add(demoSelectorPanel, BorderLayout.WEST);
    
    // Create splitpane on right to hold demo and source code
    demoSplitPane = new AnimatingSplitPane(JSplitPane.VERTICAL_SPLIT);
    demoSplitPane.setBorder(EMPTY_BORDER);
    mainPanel.add(demoSplitPane, BorderLayout.CENTER);
    
    // Create panel to contain currently running demo
    demoContainer = new JPanel();
    demoContainer.setLayout(new BorderLayout());
    demoContainer.setBorder(PANEL_BORDER);
    demoContainer.setPreferredSize(new Dimension(DEMO_PANEL_WIDTH, DEMO_PANEL_HEIGHT));
    demoSplitPane.setTopComponent(demoContainer);

    currentDemoPanel = demoPlaceholder;
    demoContainer.add(demoPlaceholder, BorderLayout.CENTER);
            
    // Create collapsible source code pane

    codeViewer = new CodeViewer();
    codeContainer = new JPanel(new BorderLayout());
    codeContainer.add(codeViewer);
    codeContainer.setBorder(PANEL_BORDER);
    codeContainer.setMinimumSize(new Dimension(0,0));
    demoSplitPane.setBottomComponent(codeContainer);
    
    addPropertyChangeListener(new SwingSetPropertyListener());        
    
    // Create shareable popup menu for demo actions
    popup = new JPopupMenu();
    popup.add(new EditPropertiesAction());
    popup.add(new ViewCodeSnippetAction());

    return mainPanel;
}
 
Example 16
/** Creates the ui. */
private void createUI() {
    setLayout(new BorderLayout());
    box = Box.createVerticalBox();
    box.setBorder(null);
    add(box, BorderLayout.CENTER);

    //
    // Literal panel
    //
    setUpLiteralPanel();
    box.add(Box.createVerticalStrut(VERTICAL_STRUCT_SIZE));

    //
    // Property / attribute
    //
    setUpPropertyPanel();
    box.add(Box.createVerticalStrut(VERTICAL_STRUCT_SIZE));

    //
    // Environment variable
    //
    setUpEnvVarPanel();
    box.add(Box.createVerticalStrut(VERTICAL_STRUCT_SIZE));

    //
    // Function panel
    //
    setUpFunctionPanel();
    box.add(Box.createVerticalStrut(VERTICAL_STRUCT_SIZE));

    //
    // Maths panel
    //
    setUpMathsPanel();
    box.add(Box.createVerticalStrut(VERTICAL_STRUCT_SIZE));

    JPanel panelRemoveParameter = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panelRemoveParameter.getLayout();
    flowLayout.setVgap(1);
    flowLayout.setHgap(1);
    panelRemoveParameter.setMinimumSize(new Dimension(150, 25));
    panelRemoveParameter.setPreferredSize(new Dimension(150, 25));
    box.add(panelRemoveParameter);

    btnRemoveParameter =
            new JButton(
                    Localisation.getString(
                            ExpressionPanelv2.class, "ExpressionSubPanel.removeParameter"));
    btnRemoveParameter.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    removeParameter();
                }
            });
    panelRemoveParameter.add(btnRemoveParameter);

    box.add(createApplyRevertPanel());
}
 
Example 17
private JPanel createButtonsPane() {
  final int buttonPaneHeight = backgroundImage.getHeight( null );
  final JPanel buttonPane = new JPanel();
  buttonPane.setLayout( null );
  buttonPane.setOpaque( false );
  buttonPane.setBackground( new Color( 0, 0, 0, 0 ) );
  buttonPane.setBorder( new EmptyBorder( 0, 0, 0, 0 ) );
  buttonPane.setMinimumSize( new Dimension( 514, buttonPaneHeight ) );
  buttonPane.setMaximumSize( new Dimension( 514, buttonPaneHeight ) );
  buttonPane.setPreferredSize( new Dimension( 514, buttonPaneHeight ) );

  try {
    final Class wizardClass =
      Class.forName( "org.pentaho.reporting.designer.extensions.wizard.NewWizardReportAction" );
    final AbstractDesignerContextAction newWizardActionListener =
      (AbstractDesignerContextAction) wizardClass.newInstance();
    newWizardActionListener.setReportDesignerContext( reportDesignerContext );
    final JButton wizardBtn = new TransparentButton();
    wizardBtn.addActionListener( newWizardActionListener );
    wizardBtn.addActionListener( closeActionListener );
    wizardBtn.setBorderPainted( true );
    wizardBtn.setBounds( 117, 137, 100, 118 );
    buttonPane.add( wizardBtn );

    final JLabel wizardLabel =
      new JLabel( newWizardActionListener.getValue( "WIZARD.BUTTON.TEXT" ).toString(), JLabel.CENTER ); //NON-NLS
    wizardLabel.setBounds( 80, 273, 165, 56 );
    buttonPane.add( wizardLabel );

    final JButton wizardLabelBtn = new TransparentButton();
    wizardLabelBtn.addActionListener( newWizardActionListener );
    wizardLabelBtn.addActionListener( closeActionListener );
    wizardLabelBtn.setBorderPainted( true );
    wizardLabelBtn.setBounds( 80, 273, 165, 56 );
    buttonPane.add( wizardLabelBtn );
  } catch ( Exception e ) {
    // todo: Remove me. Replace the code with a real extension mechanism
  }

  // Adds the new (blank) report button
  final JButton newReportBtn = new TransparentButton();
  newReportBtn.addActionListener( newReportAction );
  newReportBtn.addActionListener( closeActionListener );
  newReportBtn.setBorderPainted( true );
  newReportBtn.setBounds( 323, 137, 100, 118 );
  buttonPane.add( newReportBtn );

  final JLabel newReportLabel = new JLabel( Messages.getString( "WelcomePane.newReportLabel" ), JLabel.CENTER );
  newReportLabel.setBounds( 285, 273, 165, 56 );
  buttonPane.add( newReportLabel );

  final JButton newReportLabelBtn = new TransparentButton();
  newReportLabelBtn.addActionListener( newReportAction );
  newReportLabelBtn.addActionListener( closeActionListener );
  newReportLabelBtn.setBorderPainted( true );
  newReportLabelBtn.setBounds( 285, 273, 165, 56 );
  buttonPane.add( newReportLabelBtn );
  return buttonPane;
}
 
Example 18
public TextPanel(final MainPanel mainPanel) {
    super(new BorderLayout());

    this.mainPanel = mainPanel;
    textSearchPanel = new SearchPanel<>(new FlowLayout(), mainPanel);
    textSearchPanel.setAlignmentX(0);
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));
    topPanel.add(textSearchPanel);
    textValue = new LineMarkedEditorPane();
    add(new JScrollPane(textValue), BorderLayout.CENTER);
    textValue.setFont(Configuration.getSourceFont());
    textValue.changeContentType("text/swftext");
    textValue.addTextChangedListener(this::textChanged);

    JPanel textButtonsPanel = new JPanel();
    textButtonsPanel.setLayout(new FlowLayout(SwingConstants.WEST));
    textButtonsPanel.setMinimumSize(new Dimension(10, textButtonsPanel.getMinimumSize().height));

    selectPrevousTagButton = createButton(null, "arrowup16", "selectPreviousTag", e -> mainPanel.previousTag());
    selectNextTagButton = createButton(null, "arrowdown16", "selectNextTag", e -> mainPanel.nextTag());
    textAlignLeftButton = createButton(null, "textalignleft16", "text.align.left", e -> textAlign(TextAlign.LEFT));
    textAlignCenterButton = createButton(null, "textaligncenter16", "text.align.center", e -> textAlign(TextAlign.CENTER));
    textAlignRightButton = createButton(null, "textalignright16", "text.align.right", e -> textAlign(TextAlign.RIGHT));
    textAlignJustifyButton = createButton(null, "textalignjustify16", "text.align.justify", e -> textAlign(TextAlign.JUSTIFY));
    decreaseTranslateXButton = createButton(null, "textunindent16", "text.align.translatex.decrease", e -> translateX(-(int) SWF.unitDivisor, ((JRepeatButton) e.getSource()).getRepeatCount()), true);
    increaseTranslateXButton = createButton(null, "textindent16", "text.align.translatex.increase", e -> translateX((int) SWF.unitDivisor, ((JRepeatButton) e.getSource()).getRepeatCount()), true);
    changeCaseButton = createButton(null, "textuppercase16", "text.toggleCase", e -> changeCase(0));
    undoChangesButton = createButton(null, "reload16", "text.undo", e -> undoChanges());

    textButtonsPanel.add(selectPrevousTagButton);
    textButtonsPanel.add(selectNextTagButton);
    textButtonsPanel.add(textAlignLeftButton);
    textButtonsPanel.add(textAlignCenterButton);
    textButtonsPanel.add(textAlignRightButton);
    textButtonsPanel.add(textAlignJustifyButton);
    textButtonsPanel.add(decreaseTranslateXButton);
    textButtonsPanel.add(increaseTranslateXButton);
    textButtonsPanel.add(changeCaseButton);
    textButtonsPanel.add(undoChangesButton);

    textButtonsPanel.setAlignmentX(0);
    topPanel.add(textButtonsPanel);
    add(topPanel, BorderLayout.NORTH);

    buttonsPanel = new JPanel(new FlowLayout());
    textEditButton = createButton("button.edit", "edit16", null, e -> editText());
    textSaveButton = createButton("button.save", "save16", null, e -> saveText(true));
    textCancelButton = createButton("button.cancel", "cancel16", null, e -> cancelText());

    // hide the buttonts to aviod panel resize problems on other views
    textEditButton.setVisible(false);
    textSaveButton.setVisible(false);
    textCancelButton.setVisible(false);

    buttonsPanel.add(textEditButton);
    buttonsPanel.add(textSaveButton);
    buttonsPanel.add(textCancelButton);
    add(buttonsPanel, BorderLayout.SOUTH);
}
 
Example 19
Source Project: jdal   File: JRParameterEditorDialog.java    License: Apache License 2.0 4 votes vote down vote up
public void initialize() {
	this.setTitle("Parámetros del informe");
	
	// Main Panel containing parameter panel and button panel.
	JPanel borderPanel = new JPanel();
	borderPanel.setBorder(BorderFactory.createTitledBorder(""));
	borderPanel.setMinimumSize(borderPanel.getPreferredSize());
	borderPanel.setLayout(new BorderLayout());

	// Button Panel
	JPanel buttonPanel = new JPanel();
	JButton acceptButton = new JButton(new AcceptAction());
	acceptButton.setText("Aceptar");
	JButton cancelButton = new JButton(new CancelAction());
	cancelButton.setText("Cancelar");
	acceptButton.setAlignmentX(Component.CENTER_ALIGNMENT);
	cancelButton.setAlignmentX(Component.CENTER_ALIGNMENT);
	buttonPanel.add(acceptButton);
	buttonPanel.add(cancelButton);

	// Parameter panel
	JPanel paramPanel = new JPanel(new SpringLayout());

	for (JRParameter param : parameters.values()) {

		ReportParameterEditor propertyEditor = editorFactory
				.getParameterEditor(param);
		
		propertyEditor.getEditor().addKeyListener(new KeyPressed());
		
		JLabel label = new JLabel(param.getName());
		label.setLabelFor(propertyEditor.getEditor());
		paramPanel.add(label);
		paramPanel.add(propertyEditor.getEditor());

		editors.put(param.getName(), propertyEditor);
	}

	borderPanel.add(paramPanel, BorderLayout.PAGE_START);
	borderPanel.add(buttonPanel, BorderLayout.PAGE_END);

	SpringUtilities.makeCompactGrid(paramPanel, parameters.size(), 2, // rows,
																		// cols
			6, 6, // initX, initY
			6, 6); // xPad, yPad

	add(borderPanel);
	setLocationRelativeTo(null);
	pack();

}
 
Example 20
/**
 * Creates a new panel object.
 *
 * @param graph The graph shown in the graph window.
 * @param modules The list of modules present in the current graph.
 * @param parent The parent JFrame.
 */
public CGraphToolBarNavigationPanel(
    final ZyGraph graph, final List<INaviModule> modules, final JFrame parent) {
  super(new BorderLayout());

  m_gotoField = new CGotoAddressField(graph, modules, parent);
  m_searchPanel = new CToolbarSearchPanel(graph);

  final JPanel pBorderPanel = new JPanel(new BorderLayout());
  pBorderPanel.setBorder(new EmptyBorder(new Insets(1, 1, 1, 1)));

  final JPanel pFields = new JPanel(new BorderLayout());
  pFields.setBorder(new TitledBorder(""));

  final JPanel pSearchField = new JPanel(new BorderLayout());

  pSearchField.add(
      new CHelpLabel("   " + "Search" + " ", new CSearchFieldHelp()), BorderLayout.WEST);

  pSearchField.add(m_searchPanel, BorderLayout.CENTER);

  pSearchField.setPreferredSize(new Dimension(200, 20));
  pSearchField.setMinimumSize(new Dimension(200, 20));

  pFields.add(pSearchField, BorderLayout.CENTER);

  final JPanel pGotoField = new JPanel(new BorderLayout());
  pGotoField.add(
      new CHelpLabel("  " + "Address" + " ", new CGotoAddressHelp()), BorderLayout.WEST);

  pGotoField.add(m_gotoField, BorderLayout.CENTER);

  pGotoField.setPreferredSize(new Dimension(200, 20));
  pGotoField.setMinimumSize(new Dimension(200, 20));

  pFields.add(pGotoField, BorderLayout.WEST);

  pBorderPanel.add(pFields, BorderLayout.CENTER);

  pBorderPanel.setPreferredSize(new Dimension(400, 20));
  pBorderPanel.setMinimumSize(new Dimension(400, 20));

  add(pBorderPanel);
}