Java Code Examples for javax.swing.JLabel.setVerticalAlignment()

The following are Jave code examples for showing how to use setVerticalAlignment() of the javax.swing.JLabel 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: incubator-netbeans   File: RSSFeed.java   View Source Code Vote up 6 votes
private JComponent buildContentLoadingLabel() {
    JLabel label = new JLabel( BundleSupport.getLabel( "ContentLoading" ) ); // NOI18N
    label.setHorizontalAlignment( JLabel.CENTER );
    label.setVerticalAlignment( JLabel.CENTER );
    label.setOpaque( false );
    Component header = getContentHeader();
    if( null != header ) {
        JPanel panel = new JPanel( new GridBagLayout() );
        panel.setOpaque( false );
        panel.add( header, new GridBagConstraints(0,0,1,1,1.0,1.0,
            GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
        panel.add( label, new GridBagConstraints(0,1,1,1,1.0,1.0,
            GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
        panel.setBorder( BorderFactory.createEmptyBorder(40, 0, 40, 0));
        return panel;
    }
    label.setBorder( BorderFactory.createEmptyBorder(40, 0, 40, 0));
    return label;
}
 
Example 2
Project: incubator-netbeans   File: InsertRecordDialog.java   View Source Code Vote up 6 votes
public void refreshSQL() {
    try {
        String sqlText = "";
        if (jSplitPane1.getBottomComponent() != null) {
            SQLStatementGenerator stmtBldr = dataView.getSQLStatementGenerator();
            for (int i = 0; i < insertDataModel.getRowCount(); i++) {
                String sql = stmtBldr.generateRawInsertStatement(insertTable, getInsertValues(i));
                sqlText = sqlText + sql + "\n";
            }
            jEditorPane1.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-sql")); // NOI18N
            jEditorPane1.setText(sqlText);
            jScrollPane2.setViewportView(jEditorPane1);
        }
    } catch (DBException ex) {
        JLabel errorLabel = new JLabel(
                "<html><body><font color=\"#FF0000\">" //NOI18N
                + ex.getMessage().replaceAll("\\n", "<br>") //NOI18N
                + "</font></body></html>"); //NOI18N
        errorLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
        errorLabel.setVerticalAlignment(SwingConstants.TOP);
        jScrollPane2.setViewportView(errorLabel);
        jScrollPane2.revalidate();
        jScrollPane2.repaint();
    }
}
 
Example 3
Project: rapidminer   File: ButtonDialog.java   View Source Code Vote up 6 votes
private JPanel makeInfoPanel(String message, Icon icon) {
	JLabel infoIcon = new JLabel(icon);
	infoIcon.setVerticalAlignment(SwingConstants.TOP);
	JPanel infoPanel = new JPanel(new BorderLayout(20, 0));
	infoPanel.setBorder(BorderFactory.createEmptyBorder(12, 16, 16, 4));
	infoPanel.add(infoIcon, BorderLayout.WEST);
	int width;
	if (centerComponent != null) {
		width = (int) centerComponent.getPreferredSize().getWidth() - 88; // icon plus padding
		if (width < 420) {
			width = 420;
		}
	} else {
		width = 420;
	}

	infoTextLabel = new FixedWidthEditorPane(width, message);
	// set the background as for infoPanel such that infoTextLabel looks like a JLabel
	infoTextLabel.setBackground(infoPanel.getBackground());

	infoPanel.add(infoTextLabel, BorderLayout.CENTER);

	return infoPanel;
}
 
Example 4
Project: java-course   File: Calculator.java   View Source Code Vote up 6 votes
/**
 * Initializes GUI.
 */
private void initGUI() {
    CalcLayout pane = new CalcLayout(5);
    JPanel p = new JPanel(pane);

    display = new JLabel("0", SwingConstants.RIGHT);
    display.setMinimumSize(new Dimension(75, 75));
    display.setVerticalAlignment(SwingConstants.BOTTOM);
    display.setBackground(Color.WHITE);
    display.setOpaque(false);
    display.setFont(new Font(display.getFont().toString(), Font.BOLD, 30));

    p.add(display, new RCPosition(1, 1));

    addNumberButtons(p);
    addOperatorButtons(p);
    addFunctionButtons(p);
    addControlButtons(p);
    getContentPane().add(p);
}
 
Example 5
Project: Moenagade   File: MainFrame.java   View Source Code Vote up 6 votes
private void openImagfile(ImageFile imageFile)
{
    // eanble scrolling
    editorScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    
    JLabel label = new JLabel();
    label.setIcon(new ImageIcon(imageFile.getAbsolutePath()));
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);
    label.setBackground(BloxsColors.$BACKGROUND);
    label.setOpaque(true);
    
    editorScroller.getViewport().add(label);
    editorScroller.getViewport().validate();
    editorScroller.repaint();
}
 
Example 6
Project: Moenagade   File: MainFrame.java   View Source Code Vote up 6 votes
public void openNothing()
{
    // eanble scrolling
    editorScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    
    JLabel label = new JLabel();
    label.setText("");
    label.setFont(new Font("Monospaced", Font.BOLD, 20));
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);
    label.setBackground(BloxsColors.$BACKGROUND);
    label.setOpaque(true);
  
    editorScroller.getViewport().add(label);
    editorScroller.getViewport().validate();
    editorScroller.repaint();
}
 
Example 7
Project: ALTTPMenuPractice   File: WarningFrame.java   View Source Code Vote up 5 votes
public WarningFrame(String title, String... message) {
	super(title);
	JLabel warnText = new JLabel(String.join("\n",
			new String[] {
					"<html><div style=\"padding: 4px;\">",
					String.join("\n", message),
					"</div></html>"
			}));
	warnText.setVerticalAlignment(SwingConstants.NORTH);
	this.add(warnText);
	this.setMinimumSize(new Dimension(400, 200));
	this.setLocation(500, 500);
	this.setVisible(true);
}
 
Example 8
Project: incubator-netbeans   File: JComponentBuilders.java   View Source Code Vote up 5 votes
protected void setupInstance(JLabel instance) {
    super.setupInstance(instance);
    
    instance.setText(text);
    
    if (defaultIcon != null) instance.setIcon(defaultIcon.createInstance());
    
    instance.setVerticalAlignment(verticalAlignment);
    instance.setHorizontalAlignment(horizontalAlignment);
    instance.setVerticalTextPosition(verticalTextPosition);
    instance.setHorizontalTextPosition(horizontalTextPosition);
    instance.setIconTextGap(iconTextGap);
}
 
Example 9
Project: incubator-netbeans   File: NoWebBrowserImpl.java   View Source Code Vote up 5 votes
public NoWebBrowserImpl(String cause) {
    JLabel lbl = new JLabel(NbBundle.getMessage(NoWebBrowserImpl.class, "Err_CannotCreateBrowser", cause));
    lbl.setEnabled( false );
    lbl.setHorizontalAlignment( JLabel.CENTER );
    lbl.setVerticalAlignment( JLabel.CENTER );
    component = lbl;
}
 
Example 10
Project: jmt   File: JWatMainPanel.java   View Source Code Vote up 5 votes
public JWatMainPanel(MainJwatWizard parent) {
	this.parent = parent;
	this.help = parent.getHelp();
	this.setLayout(new BorderLayout());
	JPanel upper = new JPanel(new FlowLayout());
	JLabel upperLabel = new JLabel();
	upperLabel.setPreferredSize(new Dimension(300, 10));
	upper.add(upperLabel);

	JPanel bottom = new JPanel(new FlowLayout());
	JLabel bottomLabel = new JLabel();
	bottomLabel.setPreferredSize(new Dimension(300, 10));
	bottom.add(bottomLabel);

	this.add(upper, BorderLayout.NORTH);
	this.add(bottom, BorderLayout.SOUTH);

	JPanel eastPanel = new JPanel(new FlowLayout());
	eastPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
	JPanel buttonPanel = new JPanel(new GridLayout(buttonAction.length, 1, 2, 15));
	eastPanel.add(buttonPanel, BorderLayout.CENTER);
	for (AbstractAction element : buttonAction) {
		buttonPanel.add(createButton(element));
	}
	JLabel imageLabel = new JLabel();
	imageLabel.setBorder(BorderFactory.createEmptyBorder(BUTTONSIZE - 5, 1, 0, 0));
	//imageLabel.setIcon(new ImageIcon(image));
	imageLabel.setIcon(new ImageIcon(new ImageIcon(imageURL).getImage().getScaledInstance(400, 315, Image.SCALE_SMOOTH)));
	imageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
	imageLabel.setVerticalAlignment(SwingConstants.NORTH);

	//JLabel description = new JLabel("<html><body><h3>This is a simple<br>descirption added to this<br>page. Please do not mind it<br>will be replaced soon</h3></body></html>");
	//this.add(description,BorderLayout.WEST);
	this.add(imageLabel, BorderLayout.CENTER);
	this.add(eastPanel, BorderLayout.EAST);
	makeToolbar();
	makeMenubar();
}
 
Example 11
Project: jmt   File: LDHelpDialog.java   View Source Code Vote up 5 votes
private void initComponents() {
	Container cp = getContentPane();
	cp.setLayout(new BorderLayout());
	JPanel butPane = new JPanel();
	butPane.add(new JButton(close), BorderLayout.SOUTH);
	cp.add(butPane, BorderLayout.SOUTH);
	JTabbedPane jtp = new JTabbedPane();

	JPanel general = new JPanel(new BorderLayout());
	JLabel ghelp = new JLabel(generalHelp);
	ghelp.setHorizontalAlignment(SwingConstants.CENTER);
	ghelp.setVerticalAlignment(SwingConstants.CENTER);
	JLabel icon = new JLabel(UIManager.getIcon("OptionPane.informationIcon"));
	Box lbox = Box.createHorizontalBox();
	lbox.add(Box.createHorizontalStrut(10));
	lbox.add(icon);
	lbox.add(Box.createHorizontalStrut(10));

	general.add(ghelp, BorderLayout.CENTER);
	general.add(lbox, BorderLayout.WEST);
	general.add(Box.createHorizontalStrut(10), BorderLayout.EAST);

	jtp.add("General", general);

	JPanel evaluator = new JPanel(new BorderLayout());

	HtmlPanel ehelp = new HtmlPanel(evalHelp);

	evaluator.add(Box.createHorizontalStrut(10), BorderLayout.WEST);
	evaluator.add(new JScrollPane(ehelp), BorderLayout.CENTER);
	evaluator.add(Box.createHorizontalStrut(10), BorderLayout.EAST);

	jtp.add("Evaluator", evaluator);

	cp.add(jtp, BorderLayout.CENTER);
}
 
Example 12
Project: JDigitalSimulator   File: Guitilities.java   View Source Code Vote up 5 votes
public static JPanel createSeparator(String text) {
	JLabel title = new JLabel(text);
	title.setVerticalAlignment(0);
	title.setHorizontalAlignment(JLabel.LEFT);
	title.setFont(UIManager.getFont(TITLE_FONT).deriveFont(12f));
	title.setForeground(UIManager.getColor(TITLE_FOREGROUND));
	return createSeparator(title);
}
 
Example 13
Project: Equella   File: JCalendar.java   View Source Code Vote up 5 votes
private JComponent createCentre()
{
	dayGrid = new JPanel(new GridLayout(7, 7, 5, 5));
	dayGrid.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
	dayGrid.setBackground(Color.WHITE);
	dayGrid.addMouseListener(this);

	Map<TextAttribute, Float> dayAttributes = new HashMap<TextAttribute, Float>();
	dayAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
	Font dayFont = new Font(dayAttributes);

	for( int i = 0; i < DAYS.length; i++ )
	{
		JLabel day = new JLabel(DAYS[i]);
		day.setHorizontalAlignment(SwingConstants.CENTER);
		day.setVerticalAlignment(SwingConstants.CENTER);
		day.setFont(dayFont);

		dayGrid.add(day);
	}

	days = new DayLabel[6][7];
	for( int i = 0; i < days.length; i++ )
	{
		for( int j = 0; j < days[i].length; j++ )
		{
			days[i][j] = new DayLabel();
			days[i][j].setDay(0);
			dayGrid.add(days[i][j]);
		}
	}

	return dayGrid;
}
 
Example 14
Project: zooracle   File: GUISettings.java   View Source Code Vote up 5 votes
public static JLabel getDefaultLabel(String title, int width, int height, int align, int valign)
{
	JLabel label = new JLabel(" " + title + " ", align);
	label.setPreferredSize(new Dimension(width, height));
	label.setVerticalAlignment(valign);
	return label;
}
 
Example 15
Project: incubator-netbeans   File: DemoPanel.java   View Source Code Vote up 4 votes
@Override
protected Component createFeedItemComponent(FeedItem item) {
    JPanel panel = new JPanel( new GridBagLayout() );
    panel.setOpaque(false);
    int row = 0;

    if( item.isValid() ) {
        if( item.enclosureUrl != null ) {
            panel.add( new ImageLabel( item.link, getImage( item.enclosureUrl ), item.description ),
                    new GridBagConstraints(0,row++,1,1,0.0,0.0,
                    GridBagConstraints.WEST,GridBagConstraints.NONE,
                    new Insets(0,0,5,5),0,0 ) );
        } else {
            JLabel label = new JLabel( BundleSupport.getLabel("NoScreenShot") ); //NOI18N
            label.setHorizontalAlignment( JLabel.CENTER );
            label.setVerticalAlignment( JLabel.CENTER );
            panel.add( label, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                    GridBagConstraints.CENTER,GridBagConstraints.NONE,
                    new Insets(0,0,5,5),0,0 ) );
        }

        WebLink linkButton = new WebLink( item.title, item.link, false );
        linkButton.getAccessibleContext().setAccessibleName(
                BundleSupport.getAccessibilityName( "WebLink", item.title ) ); //NOI18N
        linkButton.getAccessibleContext().setAccessibleDescription(
                BundleSupport.getAccessibilityDescription( "WebLink", item.link ) ); //NOI18N
        linkButton.setFont( BUTTON_FONT );
        panel.add( linkButton, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.WEST,GridBagConstraints.NONE,
                new Insets(0,0,5,5),0,0 ) );
    } else {
        panel.add( new JLabel(BundleSupport.getLabel("ErrLoadingFeed")),  // NOI18N
                new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
        JButton button = new JButton();
        Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "Reload" ) );  // NOI18N
        button.setOpaque( false );
        button.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                lastReload = 0;
                reload();
            }
        });
        panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    }
    
    return panel;
}
 
Example 16
Project: incubator-netbeans   File: CustomizerPane.java   View Source Code Vote up 4 votes
public CustomizerPane(JPanel categoryView, CategoryModel categoryModel, ProjectCustomizer.CategoryComponentProvider componentProvider) {
    initComponents();
    this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerPane.class,"AD_CustomizerPane")); // NOI18N
    this.componentProvider = componentProvider;
    fillConstraints = new GridBagConstraints();
    fillConstraints.gridwidth = GridBagConstraints.REMAINDER;
    fillConstraints.gridheight = 1;
    fillConstraints.fill = GridBagConstraints.BOTH;
    fillConstraints.weightx = 1.0;
    fillConstraints.weighty = 1.0;
    categoryModel.addPropertyChangeListener( new CategoryChangeListener() );
    categoryPanel.add( categoryView, fillConstraints );

    errorIcon = new JLabel();
    errorPanel = new JPanel(new BorderLayout(errorIcon.getIconTextGap(), 0)); // cf. BasicLabelUI.layoutCL
    errorPanel.add(errorIcon, BorderLayout.LINE_START);
    errorIcon.setVerticalAlignment(SwingConstants.TOP);
    errorMessageValue = new JTextArea();
    errorMessageValue.setLineWrap(true);
    errorMessageValue.setWrapStyleWord(true);
    errorMessageValue.setBorder(BorderFactory.createEmptyBorder());
    errorMessageValue.setBackground(customizerPanel.getBackground());
    errorMessageValue.setEditable(false);
    errorPanel.add(errorMessageValue, BorderLayout.CENTER);
    
    // put it into under categoryView
    errMessConstraints = new GridBagConstraints();
    errMessConstraints.gridx = 0;
    errMessConstraints.gridy = 1;
    errMessConstraints.gridwidth = 1;
    errMessConstraints.gridheight = 1;
    errMessConstraints.insets = new Insets(12, 0, 0, 0);
    errMessConstraints.fill = GridBagConstraints.HORIZONTAL;
    customizerPanel.add(errorPanel, errMessConstraints);

    /*Preferences prefs = NbPreferences.forModule(org.netbeans.modules.project.uiapi.CustomizerPane.class);
    int paneWidth = prefs.getInt(CUSTOMIZER_DIALOG_WIDTH, 0);
    int paneHeight = prefs.getInt(CUSTOMIZER_DIALOG_HEIGHT, 0);
    if (paneWidth != 0 && paneHeight != 0) {
        previousDimension = new Dimension(paneWidth, paneHeight);
    }*/

    setCategory( categoryModel.getCurrentCategory() );
}
 
Example 17
Project: Mujeed-Arabic-Prolog   File: SwitechWorkSpaceWindow.java   View Source Code Vote up 4 votes
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	frameSwitchWorkSpace = new JDialog();
	frameSwitchWorkSpace.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
	frameSwitchWorkSpace.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	frameSwitchWorkSpace.setSize(540, 250);
	frameSwitchWorkSpace.setLocationRelativeTo(null); 
	frameSwitchWorkSpace.setFont(new Font("Arial", Font.BOLD, 13));
	frameSwitchWorkSpace.setResizable(false);
	frameSwitchWorkSpace.setModalExclusionType(ModalExclusionType.TOOLKIT_EXCLUDE);
	frameSwitchWorkSpace.setTitle("\u062A\u0628\u062F\u064A\u0644 \u0645\u0633\u0627\u062D\u0629 \u0627\u0644\u0639\u0645\u0644");
	frameSwitchWorkSpace.getContentPane().setLayout(new BorderLayout(0, 0));
	
	JPanel panelCenter = new JPanel();
	panelCenter.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
	
	JPanel panelNorth = new JPanel();
	panelNorth.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
	panelNorth.setBackground(Color.WHITE);
	panelNorth.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.GRAY));
	panelNorth.setLayout(new GridLayout(2, 1, 0, 0));
	
	JLabel lblTitle = new JLabel("\u062A\u0628\u062F\u064A\u0644 \u0645\u0633\u0627\u062D\u0629 \u0627\u0644\u0639\u0645\u0644");
	lblTitle.setFont(new Font("Arial", Font.BOLD, 20));
	lblTitle.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
	lblTitle.setBorder(new EmptyBorder(10, 0, 0, 30));
	panelNorth.add(lblTitle);
	
	JLabel lblDescription = new JLabel("\u064A\u0645\u0643\u0646\u0643 \u062D\u0641\u0638 \u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 \u0641\u064A \u0645\u062C\u0644\u062F \u064A\u0633\u0645\u0649 \u0645\u0633\u0627\u062D\u0629 \u0627\u0644\u0639\u0645\u0644");
	lblDescription.setVerticalAlignment(SwingConstants.TOP);
	lblDescription.setFont(new Font("Arial", Font.BOLD, 14));
	lblDescription.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
	lblDescription.setBorder(new EmptyBorder(10, 0, 0, 50));
	panelNorth.add(lblDescription);
	
	panelCenter.setLayout(new GridLayout(1, 1, 0, 0));
	
	JFilePicker filePicker = new JFilePicker("مساحة العمل", "استعراض...");
	filePicker.setBorder(new MatteBorder(45, 1, 1, 1, (Color) new Color(240, 240, 240)));
	panelCenter.add(filePicker);
	frameSwitchWorkSpace.getContentPane().add(panelCenter, BorderLayout.CENTER);
	
	JPanel panelSouth = new JPanel();
	frameSwitchWorkSpace.getContentPane().add(panelSouth);
	panelSouth.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
	
	btnCancel = new JButton("إلغاء الأمر");
	btnCancel.setFont(new Font("Arial", Font.BOLD, 14));
	btnCancel.setHorizontalAlignment(SwingConstants.RIGHT);
	panelSouth.add(btnCancel);
	
	btnOK = new JButton("موافق");
	btnOK.setHorizontalAlignment(SwingConstants.RIGHT);
	btnOK.setFont(new Font("Arial", Font.BOLD, 14));
	panelSouth.add(btnOK);
	
	btnCancel.addActionListener(this);
	btnOK.addActionListener(this);
	
	frameSwitchWorkSpace.getContentPane().add(panelNorth, BorderLayout.NORTH);
	frameSwitchWorkSpace.getContentPane().add(panelCenter, BorderLayout.CENTER);
	frameSwitchWorkSpace.getContentPane().add(panelSouth, BorderLayout.SOUTH);
}
 
Example 18
Project: Equella   File: DetailsTab.java   View Source Code Vote up 4 votes
@Override
public void init(Component parent)
{
	JLabel nameLabel = new JLabel(CurrentLocale.get("com.tle.admin.powersearch.detailstab.searchname")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(CurrentLocale.get("com.tle.admin.powersearch.detailstab.desc")); //$NON-NLS-1$
	JLabel ownerLabel = new JLabel(CurrentLocale.get("com.tle.admin.powersearch.detailstab.owner")); //$NON-NLS-1$

	JLabel schemaLabel = new JLabel(CurrentLocale.get("com.tle.admin.powersearch.detailstab.selectschema")); //$NON-NLS-1$
	JLabel itemdefLabel = new JLabel(CurrentLocale.get("com.tle.admin.powersearch.detailstab.selectcollections")); //$NON-NLS-1$

	descriptionLabel.setVerticalAlignment(SwingConstants.TOP);

	name = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextArea(BundleCache.getLanguages());

	owner = new SingleUserSelector(clientService.getService(RemoteUserService.class));

	itemdefs = new JShuffleBox<NameValue>();
	itemdefs.setAllowDuplicates(false);

	schemaList = new JComboBox();
	try
	{
		List<BaseEntityLabel> schemas = clientService.getService(RemoteSchemaService.class).listAll();
		List<NameValue> nameValues = BundleCache.getNameValues(schemas);
		Collections.sort(nameValues, Format.NAME_VALUE_COMPARATOR);
		AppletGuiUtils.addItemsToJCombo(schemaList, nameValues);
	}
	catch( RuntimeApplicationException ex )
	{
		LOGGER.error("Could not enumerate schemas", ex); //$NON-NLS-1$
		JOptionPane.showMessageDialog(parent, CurrentLocale.get("com.tle.admin.powersearch.detailstab.error")); //$NON-NLS-1$
	}

	schemaList.setSelectedIndex(-1);
	schemaList.addActionListener(this);
	lastSelectedIndex = -1;

	final int height1 = name.getPreferredSize().height;
	final int ownerHeight = owner.getPreferredSize().height;
	final int width1 = schemaLabel.getPreferredSize().width;

	final int[] rows = {height1, height1 * 3, ownerHeight, 20, height1, height1, TableLayout.DOUBLE_FILL,
			TableLayout.FILL};
	final int[] cols = {width1, TableLayout.DOUBLE_FILL, TableLayout.FILL,};

	setLayout(new TableLayout(rows, cols));
	setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	add(nameLabel, new Rectangle(0, 0, 1, 1));
	add(name, new Rectangle(1, 0, 1, 1));

	add(descriptionLabel, new Rectangle(0, 1, 1, 1));
	add(description, new Rectangle(1, 1, 1, 1));

	add(ownerLabel, new Rectangle(0, 2, 1, 1));
	add(owner, new Rectangle(1, 2, 1, 1));

	add(schemaLabel, new Rectangle(0, 4, 1, 1));
	add(schemaList, new Rectangle(1, 4, 1, 1));

	add(itemdefLabel, new Rectangle(0, 5, 2, 1));
	add(itemdefs, new Rectangle(0, 6, 2, 1));

	// Make sure things are readonly.
	if( state.isReadonly() )
	{
		name.setEnabled(false);
		description.setEnabled(false);
		owner.setEnabled(false);
		schemaList.setEnabled(false);
		itemdefs.setEnabled(false);
	}
}
 
Example 19
Project: Logisim   File: ExportImage.java   View Source Code Vote up 4 votes
OptionsPanel(JList<?> list) {
	// set up components
	formatPng = new JRadioButton("PNG");
	formatGif = new JRadioButton("GIF");
	formatJpg = new JRadioButton("JPEG");
	ButtonGroup bgroup = new ButtonGroup();
	bgroup.add(formatPng);
	bgroup.add(formatGif);
	bgroup.add(formatJpg);
	formatPng.setSelected(true);

	slider = new JSlider(SwingConstants.HORIZONTAL, -3 * SLIDER_DIVISIONS, 3 * SLIDER_DIVISIONS, 0);
	slider.setMajorTickSpacing(10);
	slider.addChangeListener(this);
	curScale = new JLabel("222%");
	curScale.setHorizontalAlignment(SwingConstants.RIGHT);
	curScale.setVerticalAlignment(SwingConstants.CENTER);
	curScaleDim = new Dimension(curScale.getPreferredSize());
	curScaleDim.height = Math.max(curScaleDim.height, slider.getPreferredSize().height);
	stateChanged(null);

	printerView = new JCheckBox();
	printerView.setSelected(true);

	// set up panel
	gridbag = new GridBagLayout();
	gbc = new GridBagConstraints();
	setLayout(gridbag);

	// now add components into panel
	gbc.gridy = 0;
	gbc.gridx = GridBagConstraints.RELATIVE;
	gbc.anchor = GridBagConstraints.NORTHWEST;
	gbc.insets = new Insets(5, 0, 5, 0);
	gbc.fill = GridBagConstraints.NONE;
	addGb(new JLabel(Strings.get("labelCircuits") + " "));
	gbc.fill = GridBagConstraints.HORIZONTAL;
	addGb(new JScrollPane(list));
	gbc.fill = GridBagConstraints.NONE;

	gbc.gridy++;
	addGb(new JLabel(Strings.get("labelImageFormat") + " "));
	Box formatsPanel = new Box(BoxLayout.Y_AXIS);
	formatsPanel.add(formatPng);
	formatsPanel.add(formatGif);
	formatsPanel.add(formatJpg);
	addGb(formatsPanel);

	gbc.gridy++;
	addGb(new JLabel(Strings.get("labelScale") + " "));
	addGb(slider);
	addGb(curScale);

	gbc.gridy++;
	addGb(new JLabel(Strings.get("labelPrinterView") + " "));
	addGb(printerView);
}
 
Example 20
Project: Equella   File: DetailsTab.java   View Source Code Vote up 4 votes
private void setupGUI()
{
	JLabel identifierLabel = new JLabel(getString("detailstab.identifier")); //$NON-NLS-1$
	JLabel nameLabel = new JLabel(getString("reports.detailstab.name")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(getString("detailstab.desc")); //$NON-NLS-1$
	JLabel ownerLabel = new JLabel(getString("reports.detailstab.owner")); //$NON-NLS-1$
	JLabel uploadLabel = new JLabel(getString("detailstab.design")); //$NON-NLS-1$
	JLabel hideReportLabel = new JLabel(getString("detailstab.hidereport")); //$NON-NLS-1$

	descriptionLabel.setVerticalAlignment(SwingConstants.TOP);

	identifier = new JTextField();
	identifier.setEditable(false);
	name = new I18nTextField(BundleCache.getLanguages());
	description = new I18nTextArea(BundleCache.getLanguages());
	owner = new SingleUserSelector(clientService.getService(RemoteUserService.class));
	hideReport = new JCheckBox();

	final int height1 = owner.getPreferredSize().height;
	final int width1 = hideReportLabel.getPreferredSize().width;

	final int[] rows = {height1, height1, height1 * 3, height1, height1, height1, TableLayout.FILL,};
	final int[] cols = {width1, TableLayout.DOUBLE_FILL, TableLayout.FILL,};

	setLayout(new TableLayout(rows, cols));

	add(identifierLabel, new Rectangle(0, 0, 1, 1));
	add(identifier, new Rectangle(1, 0, 1, 1));

	add(nameLabel, new Rectangle(0, 1, 1, 1));
	add(name, new Rectangle(1, 1, 1, 1));

	add(descriptionLabel, new Rectangle(0, 2, 1, 1));
	add(description, new Rectangle(1, 2, 1, 1));

	add(ownerLabel, new Rectangle(0, 3, 1, 1));
	add(owner, new Rectangle(1, 3, 1, 1));

	// Make sure things are readonly.
	if( state.isReadonly() )
	{
		name.setEnabled(false);
		description.setEnabled(false);
		owner.setEnabled(false);
	}

	initialReport = new JComboBox();
	initialReport.setEditable(false);
	initialReport.setPreferredSize(new Dimension(230, 23));

	upload = new JButton(getString("detailstab.upload")); //$NON-NLS-1$
	upload.addActionListener(this);

	download = new JButton(getString("detailstab.download")); //$NON-NLS-1$
	download.addActionListener(this);

	add(uploadLabel, new Rectangle(0, 4, 1, 1));

	// Stupid java layout!!!
	JPanel panelsomething = new JPanel();
	panelsomething.setLayout(new BorderLayout(0, 0));
	panelsomething.add(upload, BorderLayout.WEST);
	panelsomething.add(download, BorderLayout.EAST);
	JPanel panelsomething2 = new JPanel();
	panelsomething2.setLayout(new BorderLayout(5, 10));
	panelsomething2.add(initialReport, BorderLayout.CENTER);
	panelsomething2.add(panelsomething, BorderLayout.EAST);

	panelsomething2.add(initialReport, BorderLayout.CENTER);
	panelsomething2.add(panelsomething, BorderLayout.EAST);

	add(panelsomething2, new Rectangle(1, 4, 1, 1));

	add(hideReportLabel, new Rectangle(0, 5, 1, 1));
	add(hideReport, new Rectangle(1, 5, 1, 1));
}