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

The following are Jave code examples for showing how to use setMinimumSize() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ALTTPMenuPractice   File: TurnAnalyzer.java   View Source Code Vote up 6 votes
@SuppressWarnings("serial")
public TurnAnalyzer(JFrame frame) {
	super(frame,"Turn analysis");
	menuPainter = new JPanel() {
		public void paint(Graphics g) {
			if (refImg == null) {
				return;
			}
			Graphics2D g2 = (Graphics2D) g;
			g2.scale(2, 2);

			g2.drawImage(refImg, 0, 0, null);
		}
	};
	menuPainter.setPreferredSize(MENU_SIZE_X2);
	menuPainter.setMinimumSize(MENU_SIZE_X2);
	menuPainter.setSize(MENU_SIZE_X2);
	initialize();
}
 
Example 2
Project: jmt   File: MMQueues.java   View Source Code Vote up 6 votes
private JPanel getSplitter(int widht, int height) {
	JPanel splitPane = new JPanel();
	Dimension dim = new Dimension(widht, height);
	splitPane.setEnabled(false);
	splitPane.setPreferredSize(dim);
	splitPane.setMaximumSize(dim);
	splitPane.setMinimumSize(dim);
	return splitPane;
}
 
Example 3
Project: etomica   File: MyApplet.java   View Source Code Vote up 6 votes
public void addCluster(ClusterDiagram newCluster) {
	totalNumberOfCluster+=1;
	totalNCluster.setText(String.valueOf(totalNumberOfCluster));
    ClusterDiagram copy = new ClusterDiagram(newCluster);
    boolean fBonds = true;
    boolean eBonds = false;
    if (fDrawBondsCB.isEnabled()) {
        fBonds = fDrawBondsCB.getState();
        eBonds = eDrawBondsCB.getState();
    }
    ClusterPanel cp = new ClusterPanel(copy, drawPoints, drawNumbersWhite, drawNumbersBlack, fBonds, eBonds);
    //cp.addMouseListener(new MouseEventClusterPanel());
    Dimension d = new Dimension();
    d.width=100;
    d.height=100;
    cp.setSize(d);
    JPanel jp = new JPanel(new java.awt.GridLayout(1,1));
    cp.addMouseListener(new MouseEventClusterPanel());
    jp.setPreferredSize(d);
    jp.setMinimumSize(d);
    jp.add(cp);
    jp.setBackground(null);
    graphicOut2.add(jp);
    myPanel.updateUI();
}
 
Example 4
Project: geomapapp   File: CustomDB.java   View Source Code Vote up 6 votes
protected void createConfigPanel(JPanel p) {
	configPanel = new JPanel(new GridLayout(0,1));
	configPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
	configPanel.add(p);

	//JOC : Set a min size width to keep combo boxs under control
	configPanel.setMinimumSize(new Dimension(110, configPanel.getMinimumSize().height));
	configPanel.setPreferredSize(new Dimension(160, configPanel.getPreferredSize().height));
}
 
Example 5
Project: incubator-netbeans   File: ActiveConfigAction.java   View Source Code Vote up 5 votes
@Override
public Component getToolbarPresenter() {
    // Do not return combo box directly; looks bad.
    JPanel toolbarPanel = new JPanel(new GridBagLayout());
    toolbarPanel.setOpaque(false); // don't interrupt JToolBar background
    toolbarPanel.setMaximumSize(new Dimension(150, 80));
    toolbarPanel.setMinimumSize(new Dimension(150, 0));
    toolbarPanel.setPreferredSize(new Dimension(150, 23));
    initConfigListCombo();
    // XXX top inset of 2 looks better w/ small toolbar, but 1 seems to look better for large toolbar (the default):
    toolbarPanel.add(configListCombo, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 6, 1, 5), 0, 0));
    return toolbarPanel;
}
 
Example 6
Project: incubator-netbeans   File: InfoPanel.java   View Source Code Vote up 5 votes
private JPanel createSeparator() {
    JPanel panel = new JPanel();
    panel.setBackground(javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    panel.setMaximumSize(new java.awt.Dimension(32767, 1));
    panel.setMinimumSize(new java.awt.Dimension(10, 1));
    panel.setPreferredSize(new java.awt.Dimension(0, 1));
    return panel;
}
 
Example 7
Project: rapidminer   File: UpdatePanelTab.java   View Source Code Vote up 5 votes
protected Component makeBottomPanel() {
    JPanel panel = new JPanel(new FlowLayout(0));
    panel.setMinimumSize(new Dimension(100, 35));
    panel.setPreferredSize(new Dimension(100, 35));
    panel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY));
    return panel;
}
 
Example 8
Project: VASSAL-src   File: TranslateWindow.java   View Source Code Vote up 5 votes
protected Component buildMainPanel() {
  JPanel keyPanel = buildKeyTablePanel();

  /*
   * Tree of all components from target component down
   */
  JPanel treePanel = new JPanel(new BorderLayout());
  MyTreeNode top = new MyTreeNode(target);
  createNodes(top);
  tree = new JTree(top);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.addTreeSelectionListener(this);
  tree.setSelectionRow(0);
  tree.setCellRenderer(new MyTreeCellRenderer());
  JScrollPane treeScroll = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
      JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  treePanel.add(treeScroll, BorderLayout.CENTER);
  treePanel.setMinimumSize(new Dimension(400, 100));
  treePanel.setPreferredSize(new Dimension(800, 300));

  /*
   * First split between Tree display and Keys
   */
  JSplitPane split1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, keyPanel);
  split1.setResizeWeight(0.5);

  return split1;
}
 
Example 9
Project: QN-ACTR-Release   File: MMQueues.java   View Source Code Vote up 5 votes
private JPanel getSplitter(int widht, int height) {
	JPanel splitPane = new JPanel();
	Dimension dim = new Dimension(widht, height);
	splitPane.setEnabled(false);
	splitPane.setPreferredSize(dim);
	splitPane.setMaximumSize(dim);
	splitPane.setMinimumSize(dim);
	return splitPane;
}
 
Example 10
Project: jaer   File: CochleaTow4EarControlPanel.java   View Source Code Vote up 5 votes
private JPanel buildCochleaChannelsLRTab(String lTitle, List<CochleaChannelConfig> lChannels, String rTitle, List<CochleaChannelConfig> rChannels) {
	JPanel channelPanel = new JPanel();
	channelPanel.setLayout(new BoxLayout(channelPanel, BoxLayout.X_AXIS));
	channelPanel.add(buildCochleaChannelsGroup(lTitle, lChannels));
	channelPanel.add(buildCochleaChannelsGroup(rTitle, rChannels));
	channelPanel.setMinimumSize(channelPanel.getLayout().minimumLayoutSize(channelPanel));
	return channelPanel;
}
 
Example 11
Project: geomapapp   File: Digitizer.java   View Source Code Vote up 5 votes
void initTools() {
	tools = new JPanel(new BorderLayout());
	tools.setMinimumSize(new Dimension(200, tools.getMinimumSize().height));
	tools.setPreferredSize(new Dimension(200, tools.getPreferredSize().height));
	JPanel panel = new JPanel(new GridLayout(0,1));

	helpBtn = new JButton("Help");
	helpBtn.addActionListener(this);
	panel.add(helpBtn);
	
	startStopBtn = new JToggleButton("Start digitizing");
	startStopBtn.addActionListener(this);
	startStopBtn.setForeground(new Color(0,128,0));
	panel.add(startStopBtn);
	
	deleteBtn = new JButton("Delete segment(s)");
	deleteBtn.addActionListener(this);
	panel.add(deleteBtn);
	
	addBtn = new JButton("Add to segment");
	addBtn.addActionListener(this);
	addBtn.setEnabled(false);
	panel.add(addBtn);
	
	objectClasses = new Class[2];
	objectClasses[0] = null;
	tools.add( panel, "North" );
	tools.add( new JScrollPane( list ), "Center");
	try {
		objectClasses[1] = Class.forName( "haxby.db.dig.LineSegmentsObject" );
	} catch( Exception ex) {
		ex.printStackTrace();
		objectClasses[1] = null;
	}
}
 
Example 12
Project: chipKIT-importer   File: ProgressTrackingPanel.java   View Source Code Vote up 5 votes
private JComponent createImportFailedPane( Exception cause ) {
    JLabel infoLabel = new JLabel( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.importFailedMessage" ));
    infoLabel.setHorizontalAlignment(JLabel.CENTER );
    infoLabel.setBackground(Color.red);
    infoLabel.setOpaque(true);
    infoLabel.setBorder( BorderFactory.createLineBorder(Color.red, 3) );
    
    ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
    PrintWriter printWriter = new PrintWriter( arrayOutputStream );
    cause.printStackTrace( printWriter );
    printWriter.flush();
    String stackTraceText = arrayOutputStream.toString();
    
    JTextArea stackTraceTextArea = new JTextArea( stackTraceText );
    stackTraceTextArea.setEditable(false);
    
    JScrollPane scrollPane = new JScrollPane( stackTraceTextArea );        
    
    JButton copyToClipboardButton = new JButton( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.copyToClipboard" ));
    copyToClipboardButton.addActionListener( (a) -> {
        Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
        defaultToolkit.getSystemClipboard().setContents( new StringSelection(stackTraceText), null );
    });
    
    JPanel p1 = new JPanel( new FlowLayout(FlowLayout.TRAILING) );
    p1.add( copyToClipboardButton );
    
    JPanel p2 = new JPanel( new BorderLayout(0, 10) );
    p2.add( infoLabel, BorderLayout.NORTH );
    p2.add( scrollPane, BorderLayout.CENTER );        
    p2.add( p1, BorderLayout.SOUTH );
    p2.setSize( new Dimension(600,400) );
    p2.setMinimumSize( p2.getSize() );
    p2.setPreferredSize( p2.getSize() );
    
    return p2;
}
 
Example 13
Project: incubator-netbeans   File: ProfilerOptionsContainer.java   View Source Code Vote up 4 votes
private void initUI() {
    categoriesModel = new CategoriesListModel();
    categoriesSelection = new CategoriesSelectionModel();
    
    scrollIncrement = new JCheckBox("XXX").getPreferredSize().height; // NOI18N
    
    JList<ProfilerOptionsPanel> categoriesList = new JList(categoriesModel) {
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            dim.width = Math.max(dim.width + 20, 140);
            return dim;
        }
    };
    categoriesList.setVisibleRowCount(0);
    categoriesList.setSelectionModel(categoriesSelection);
    categoriesList.setCellRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            String panelName = " " + ((ProfilerOptionsPanel)value).getDisplayName() + " "; // NOI18N
            return super.getListCellRendererComponent(list, panelName, index, isSelected, cellHasFocus);
        }
    });
    
    JScrollPane categoriesScroll = new JScrollPane(categoriesList);
    
    JLabel categoriesLabel = new JLabel();
    categoriesLabel.setHorizontalAlignment(JLabel.LEADING);
    Mnemonics.setLocalizedText(categoriesLabel, Bundle.ProfilerOptionsContainer_Categories());
    categoriesLabel.setLabelFor(categoriesList);
    int labelOffset = 6;
    
    JPanel categoriesPanel = new JPanel(new BorderLayout(0, labelOffset));
    categoriesPanel.add(categoriesLabel, BorderLayout.NORTH);
    categoriesPanel.add(categoriesScroll, BorderLayout.CENTER);
    
    content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(categoriesLabel.getPreferredSize().height + labelOffset, 11, 0, 0));
    content.setMinimumSize(new Dimension(0, 0));
    content.setPreferredSize(new Dimension(0, 0));
    
    setLayout(new BorderLayout());
    add(categoriesPanel, BorderLayout.WEST);
    add(content, BorderLayout.CENTER);
}
 
Example 14
Project: rapidminer   File: ConfigurableDialog.java   View Source Code Vote up 4 votes
/**
 * Initializes the GUI.
 */
private void initGUI() {
	realOuterPanel = new JPanel(new BorderLayout());

	outerLayer = new JLayer<JPanel>(realOuterPanel);
	savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON,
			I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f);
	outerLayer.setGlassPane(savingGlassPane);
	savingGlassPane.setVisible(false);

	JPanel pagePanel = new JPanel(new BorderLayout());

	// list of configurables
	JPanel configPanel = createConfigPanel();
	// force size so it does not resize itself depending on entered values
	configPanel.setMinimumSize(CONFIG_LIST_SIZE);
	configPanel.setMaximumSize(CONFIG_LIST_SIZE);
	configPanel.setPreferredSize(CONFIG_LIST_SIZE);
	buttonPanel = createConfigurableButtonPanel();
	// create middle spacer
	JLabel spacer = new JLabel();
	spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE);
	// add both to an outer panel for layout reasons
	JPanel outerConfigPanel = new JPanel(new BorderLayout());
	outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY));
	outerConfigPanel.add(configPanel, BorderLayout.CENTER);
	outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH);
	// another panel for layouting
	JPanel outermostConfigPanel = new JPanel(new BorderLayout());
	outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER);
	outermostConfigPanel.add(spacer, BorderLayout.EAST);

	// glass pane showed if the user is not able to edit connections due to an old version of
	// the server
	simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f);

	// panel displaying the selected configurable
	JPanel paramPanel = createParameterPanel();

	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1;
	c.weighty = 0.3;
	c.gridwidth = GridBagConstraints.REMAINDER;

	// add panels to page panel
	pagePanel.add(outermostConfigPanel, BorderLayout.WEST);
	pagePanel.add(paramPanel, BorderLayout.CENTER);

	// add page and button panel to outer panel
	realOuterPanel.add(pagePanel, BorderLayout.CENTER);

	layoutDefault(outerLayer, makeSaveButton(), makeCancel());
	setDefaultSize(ButtonDialog.HUGE);
	setLocationRelativeTo(ApplicationFrame.getApplicationFrame());
	setModal(true);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new WindowAdapter() {

		@Override
		public void windowClosing(WindowEvent e) {
			cancelButton.doClick();
		}
	});

	updateButtonState(true);
}
 
Example 15
Project: jmt   File: FiringSectionPanel.java   View Source Code Vote up 4 votes
private void initComponents() {
	setLayout(new BorderLayout());

	String modeName = stationData.getTransitionModeName(stationKey, 0);
	firingBorder = new TitledBorder(new EtchedBorder(), "Firing Outcome for " + modeName);
	firingTable = new FiringOutcomeTable();
	firingPane = new JScrollPane(firingTable);
	firingPane.setBorder(firingBorder);
	firingPane.setMinimumSize(new Dimension(300, 240));

	leftPanel = new WarningScrollTable(firingPane, WARNING_CLASS_OUTGOING_ROUTING);
	leftPanel.addCheckVector(stationOutKeys);
	leftPanel.addCheckVector(classKeys);

	addModeButton = new JButton("Add Mode");
	addModeButton.setMinimumSize(DIM_BUTTON_M);
	modeTable = new ModeTable();
	JPanel modePanel = new JPanel(new BorderLayout(5, 5));
	modePanel.setBorder(new TitledBorder(new EtchedBorder(), "Modes"));
	modePanel.setMinimumSize(new Dimension(200, 120));
	modePanel.add(addModeButton, BorderLayout.NORTH);
	modePanel.add(new JScrollPane(modeTable), BorderLayout.CENTER);

	noticeText = new JTextArea("");
	noticeText.setOpaque(false);
	noticeText.setEditable(false);
	noticeText.setLineWrap(true);
	noticeText.setWrapStyleWord(true);
	JScrollPane noticePane = new JScrollPane(noticeText);
	noticePane.setBorder(new TitledBorder(new EtchedBorder(), "Notice"));
	noticePane.setMinimumSize(new Dimension(200, 120));

	JSplitPane rightPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	rightPanel.setBorder(new EmptyBorder(0, 0, 0, 0));
	rightPanel.setDividerSize(4);
	rightPanel.setResizeWeight(1.0);
	rightPanel.setLeftComponent(modePanel);
	rightPanel.setRightComponent(noticePane);

	JSplitPane mainPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
	mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	mainPanel.setDividerSize(4);
	mainPanel.setResizeWeight(1.0);
	mainPanel.setLeftComponent(leftPanel);
	mainPanel.setRightComponent(rightPanel);

	add(mainPanel);
}
 
Example 16
Project: jmt   File: EnablingSectionPanel.java   View Source Code Vote up 4 votes
private void initComponents() {
	setLayout(new BorderLayout());

	String modeName = stationData.getTransitionModeName(stationKey, 0);
	enablingBorder = new TitledBorder(new EtchedBorder(), "Enabling Condition for " + modeName);
	enablingTable = new ConditionTable(true);
	enablingPane = new JScrollPane(enablingTable);
	enablingPane.setBorder(enablingBorder);
	enablingPane.setMinimumSize(new Dimension(300, 120));

	inhibitingBorder = new TitledBorder(new EtchedBorder(), "Inhibiting Condition for " + modeName);
	inhibitingTable = new ConditionTable(false);
	inhibitingPane = new JScrollPane(inhibitingTable);
	inhibitingPane.setBorder(inhibitingBorder);
	inhibitingPane.setMinimumSize(new Dimension(300, 120));

	JPanel conditionPanel = new JPanel(new GridLayout(2, 1, 3, 3));
	conditionPanel.add(enablingPane);
	conditionPanel.add(inhibitingPane);

	leftPanel = new WarningScrollTable(conditionPanel, WARNING_CLASS_INCOMING_ROUTING);
	leftPanel.addCheckVector(stationInKeys);
	leftPanel.addCheckVector(classKeys);

	addModeButton = new JButton("Add Mode");
	addModeButton.setMinimumSize(DIM_BUTTON_M);
	modeTable = new ModeTable();
	JPanel modePanel = new JPanel(new BorderLayout(5, 5));
	modePanel.setBorder(new TitledBorder(new EtchedBorder(), "Modes"));
	modePanel.setMinimumSize(new Dimension(200, 120));
	modePanel.add(addModeButton, BorderLayout.NORTH);
	modePanel.add(new JScrollPane(modeTable), BorderLayout.CENTER);

	noticeText = new JTextArea("");
	noticeText.setOpaque(false);
	noticeText.setEditable(false);
	noticeText.setLineWrap(true);
	noticeText.setWrapStyleWord(true);
	JScrollPane noticePane = new JScrollPane(noticeText);
	noticePane.setBorder(new TitledBorder(new EtchedBorder(), "Notice"));
	noticePane.setMinimumSize(new Dimension(200, 120));

	JSplitPane rightPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
	rightPanel.setBorder(new EmptyBorder(0, 0, 0, 0));
	rightPanel.setDividerSize(4);
	rightPanel.setResizeWeight(1.0);
	rightPanel.setLeftComponent(modePanel);
	rightPanel.setRightComponent(noticePane);

	JSplitPane mainPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
	mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
	mainPanel.setDividerSize(4);
	mainPanel.setResizeWeight(1.0);
	mainPanel.setLeftComponent(leftPanel);
	mainPanel.setRightComponent(rightPanel);

	add(mainPanel);
}
 
Example 17
Project: smile_1.5.0_java7   File: SmileDemo.java   View Source Code Vote up 4 votes
public SmileDemo() {
    super(new GridLayout(1,0));

    //Create the nodes.
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Smile");
    createNodes(top);

    //Create a tree that allows one selection at a time.
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    //Listen for when the selection changes.
    tree.addTreeSelectionListener(this);

    //Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(tree);

    JPanel placeholder = new JPanel(new BorderLayout());
    placeholder.setBackground(Color.white);

    //Create the log pane.
    logPane = new JTextArea();
    logPane.setEditable(false);
    JScrollPane logView = new JScrollPane(logPane);
    redirectSystemStreams();

    workspace = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    workspace.setTopComponent(placeholder);
    workspace.setBottomComponent(logView);
    workspace.setDividerLocation(700);

    //Add the scroll panes to a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setLeftComponent(treeView);
    splitPane.setRightComponent(workspace);

    Dimension minimumSize = new Dimension(100, 50);
    placeholder.setMinimumSize(minimumSize);
    logView.setMinimumSize(minimumSize);
    workspace.setMinimumSize(minimumSize);
    treeView.setMinimumSize(minimumSize);
    splitPane.setDividerLocation(300);
    splitPane.setPreferredSize(new Dimension(1000, 800));

    //Add the split pane to this panel.
    add(splitPane);
}
 
Example 18
Project: Equella   File: FileListPanel.java   View Source Code Vote up 4 votes
public Renderer()
{
	dateFormat = new SimpleDateFormat();

	icon = new IconLabel();

	filename = new JLabel(" ");
	// filename.setVerticalAlignment(SwingConstants.CENTER);

	Font f = filename.getFont();
	filename.setFont(f.deriveFont((float) (f.getSize() + 2)));

	sizeLabel = new JLabel(CurrentLocale.get("cell.size"));
	size = new JLabel();
	modifiedLabel = new JLabel(CurrentLocale.get("cell.modified"));
	modified = new JLabel();

	Dimension modPrefSize = modifiedLabel.getPreferredSize();
	final int width1 = 40;
	final int width2 = Math.max(sizeLabel.getPreferredSize().width, modPrefSize.width) + 5;
	final int height1 = filename.getPreferredSize().height;
	final int height2 = modPrefSize.height;

	MigLayout layout = new MigLayout("", "[" + width1 + "][" + width2 + "][200 - " + (width2 + width1) + "]",
		"[" + height1 + "]2[" + height2 + "]2[" + height2 + "]");

	base = new JPanel(layout);
	base.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	base.setBackground(Color.WHITE);

	base.add(icon, "cell 0 0, spany 3");
	base.add(filename, "cell 1 0, spanx 2");
	base.add(sizeLabel, "cell 1 1");
	base.add(size, "cell 2 1");
	base.add(modifiedLabel, "cell 1 2");
	base.add(modified, "cell 2 2");
	int prefHeight = height1 + (height2 * 2) + 24; // size of the 3 rows
													// plus a little
													// padding

	base.setPreferredSize(new Dimension(MAX_CELL_WIDTH, prefHeight));
	base.setMaximumSize(new Dimension(MAX_CELL_WIDTH, prefHeight));
	base.setMinimumSize(new Dimension(MAX_CELL_WIDTH, prefHeight));

	if( CurrentLocale.isRightToLeft() )
	{
		base.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

	}
}
 
Example 19
Project: Equella   File: ListWithView.java   View Source Code Vote up 4 votes
public ListWithView(boolean enableUpDown, boolean enableAddRemove, TLEAction... additionalActions)
{
	this.enableAddRemove = enableAddRemove;

	actions = new ArrayList<TLEAction>();
	for( TLEAction additionalAction : additionalActions )
	{
		actions.add(additionalAction);
	}
	actions.add(upAction);
	actions.add(downAction);
	actions.add(addAction);
	actions.add(removeAction);

	final JTextlessButton upButton = new JTextlessButton(upAction);
	final JTextlessButton downButton = new JTextlessButton(downAction);
	final JButton addButton = new JButton(addAction);
	final JButton removeButton = new JButton(removeAction);

	list = new JList<>(model);
	list.addMouseListener(new ListPopupListener(list, actions));
	list.addListSelectionListener(new ListSelectionListener()
	{
		@Override
		public void valueChanged(ListSelectionEvent e)
		{
			onListSelectionChange();
			update();
		}
	});

	final JPanel left = new JPanel(new MigLayout("insets 0, fill, wrap 5, hidemode 2", "[][grow][][][grow]",
		"[grow][][][grow][]"));
	left.add(new JScrollPane(list), "skip, grow, span 4 4");
	left.add(upButton);
	left.add(downButton);
	left.add(addButton, "skip 3, align right");
	left.add(removeButton);

	if( !enableUpDown )
	{
		upButton.setVisible(false);
		downButton.setVisible(false);
	}

	if( !enableAddRemove )
	{
		addButton.setVisible(false);
		removeButton.setVisible(false);
	}

	// This makes the left-panel more "stable" and reliable in the splitter.
	left.setMinimumSize(new Dimension(200, 0));
	left.setPreferredSize(left.getMaximumSize());

	JSplitPane split = AppletGuiUtils.createSplitPane();
	split.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
	split.setContinuousLayout(true);
	split.setResizeWeight(0.1);

	split.add(left, JSplitPane.LEFT);
	split.add(editorContainer, JSplitPane.RIGHT);

	setLayout(new GridLayout(1, 1));
	add(split);

	update();
}
 
Example 20
Project: xdman   File: XDMMainWindow.java   View Source Code Vote up 4 votes
private void createTabs() {
	JButton btnAllTab = new XDMButton(getString("ALL_DOWNLOADS")),
			btnIncompleteTab = new XDMButton(getString("ALL_UNFINISHED")),
			btnCompletedTab = new XDMButton(getString("ALL_FINISHED"));

	btnTabArr = new JButton[3];
	btnTabArr[0] = btnAllTab;
	btnTabArr[0].setName("ALL_DOWNLOADS");
	btnTabArr[1] = btnIncompleteTab;
	btnTabArr[1].setName("ALL_UNFINISHED");
	btnTabArr[2] = btnCompletedTab;
	btnTabArr[2].setName("ALL_FINISHED");

	for (int i = 0; i < 3; i++) {
		btnTabArr[i].setFont(StaticResource.plainFontBig);
		btnTabArr[i].setBorderPainted(false);
		btnTabArr[i].addActionListener(this);
	}

	btnAllTab.setBackground(new Color(242, 242, 242));

	btnIncompleteTab.setBackground(StaticResource.titleColor);
	btnIncompleteTab.setForeground(StaticResource.whiteColor);

	btnCompletedTab.setBackground(StaticResource.titleColor);
	btnCompletedTab.setForeground(StaticResource.whiteColor);

	JPanel pp = new JPanel(new BorderLayout());
	pp.setOpaque(false);

	JPanel p = new JPanel(new GridLayout(1, 3, 5, 0));
	p.setOpaque(false);
	Dimension d = new Dimension(350, 30);
	p.setPreferredSize(d);
	p.setMaximumSize(d);
	p.setMinimumSize(d);
	p.setBackground(Color.WHITE);
	p.add(btnAllTab);
	p.add(btnIncompleteTab);
	p.add(btnCompletedTab);
	pp.add(p, BorderLayout.EAST);

	getTitlePanel().add(pp, BorderLayout.SOUTH);
}