当前位置: 首页>>代码示例>>Java>>正文


Java JPanel.setBorder方法代码示例

本文整理汇总了Java中javax.swing.JPanel.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.setBorder方法的具体用法?Java JPanel.setBorder怎么用?Java JPanel.setBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JPanel的用法示例。


在下文中一共展示了JPanel.setBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConfigPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
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));
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:10,代码来源:CustomDB.java

示例2: HelpDialog

import javax.swing.JPanel; //导入方法依赖的package包/类
public HelpDialog() {
	setTitle(StringResource.getString("DEFAULT_TITLE"));
	setSize(640, 480);
	htmlPane = new JEditorPane();
	JPanel panel = new JPanel(new BorderLayout(5, 5));
	panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	panel.add(new JScrollPane(htmlPane));
	add(panel);
	model = new HelpListModel();
	helpList = new JList(values);
	JPanel p = new JPanel(new BorderLayout());
	p.add(createToolBar(), BorderLayout.NORTH);
	p.add(new JScrollPane(helpList));
	panel.add(p, BorderLayout.WEST);
	setIconImage(XDMIconMap.getIcon("APP_ICON").getImage());
	helpList.addListSelectionListener(this);
	htmlPane.setEditable(false);
	map.put(keys[0], getClass().getResource(
			"/help/browser_integration.html"));
	map.put(keys[1], getClass().getResource("/help/video_download.html"));
	map.put(keys[2], getClass().getResource("/help/refresh_link.html"));
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:23,代码来源:HelpDialog.java

示例3: createButtonPane

import javax.swing.JPanel; //导入方法依赖的package包/类
public JPanel createButtonPane() {
	ButtonGroup group = new ButtonGroup();

	// Text Button Panel
	JPanel ButtonPanel = new JPanel();
	ButtonPanel.setLayout(new BoxLayout(ButtonPanel, BoxLayout.X_AXIS));
	ButtonPanel.setBorder(border5);
 
	// Add Button

	btn1 = createRun1Button(); ButtonPanel.add(btn1); group.add(btn1); ButtonPanel.add(Box.createRigidArea(VGAP5));
	btn2 = createRun2Button(); ButtonPanel.add(btn2); group.add(btn2); ButtonPanel.add(Box.createRigidArea(VGAP5));
	btn3 = createRun3Button(); ButtonPanel.add(btn3); group.add(btn3); ButtonPanel.add(Box.createRigidArea(VGAP5));
	btn4 = createRun4Button(); ButtonPanel.add(btn4); group.add(btn4); ButtonPanel.add(Box.createRigidArea(VGAP5));
	
	return ButtonPanel;
}
 
开发者ID:HML-UnBBayes,项目名称:hml,代码行数:18,代码来源:TreePanel_Container.java

示例4: TablePanel

import javax.swing.JPanel; //导入方法依赖的package包/类
public TablePanel(Table aTable) {
	table = aTable;
	innerPanel = new JPanel();
	
	add(innerPanel);
	
	// Adding the panel's border padding
	setLayout(new FlowLayout(FlowLayout.LEFT));
	innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
	innerPanel.setBorder(BorderFactory.createEmptyBorder(NEW_TABLE_PANEL_TOP_PADDING, 
											NEW_TABLE_PANEL_LEFT_PADDING, 
											NEW_TABLE_PANEL_BOTTOM_PADDING, 
											NEW_TABLE_PANEL_RIGHT_PADDING));
	
	// Fill the panel with the attributes info
	addAttributes();
	
	// Common settings
	setBackground(BACKGROUND_COLOR);
	innerPanel.setBackground(BACKGROUND_COLOR);
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:22,代码来源:TablePanel.java

示例5: createComponent

import javax.swing.JPanel; //导入方法依赖的package包/类
public static JComponent createComponent() {
	JPanel panel = new JPanel(new BorderLayout());
	panel.setDoubleBuffered(false);

	panel.add(new JButton("Press me!"), BorderLayout.NORTH);

	JProgressBar bar = new JProgressBar() {
		protected void paintComponent(java.awt.Graphics g) {
			if (g instanceof GLGraphics2D
					) {
				super.paintComponent(g);
			} else {
				System.out.println(g.getClass());
			}
		}
	};
	bar.setIndeterminate(true);
	panel.add(bar, BorderLayout.SOUTH);
	panel.add(new JSlider(SwingConstants.VERTICAL, 0, 10, 3), BorderLayout.EAST);

	ButtonGroup grp = new ButtonGroup();
	JRadioButton radio1 = new JRadioButton("FM");
	JRadioButton radio2 = new JRadioButton("AM");
	grp.add(radio1);
	grp.add(radio2);

	JPanel panel2 = new JPanel(new GridLayout(0, 1));
	panel2.add(radio1);
	panel2.add(radio2);

	JComboBox b = new JComboBox(new String[] {"3", "4"});

	panel.add(b, BorderLayout.WEST);

	panel.setBorder(BorderFactory.createTitledBorder("Border"));

	return panel;
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:39,代码来源:Example.java

示例6: run

import javax.swing.JPanel; //导入方法依赖的package包/类
public void run() {
    if (this.infos == null) {
        this.infos = UIManager.getInstalledLookAndFeels();
        Thread.currentThread().setUncaughtExceptionHandler(this);
        JPanel panel = new JPanel();
        panel.setBorder(this);
        this.frame = new JFrame(getClass().getSimpleName());
        this.frame.add(panel);
        this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.frame.setVisible(true);
    }
    if (this.index == this.infos.length) {
        this.frame.dispose();
    }
    else {
        LookAndFeelInfo info = this.infos[this.index % this.infos.length];
        try {
            UIManager.setLookAndFeel(info.getClassName());
        }
        catch (Exception exception) {
            System.err.println("could not change look and feel");
        }
        SwingUtilities.updateComponentTreeUI(this.frame);
        this.frame.pack();
        this.frame.setLocationRelativeTo(null);
        this.index++;
        SwingUtilities.invokeLater(this);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:Test6981576.java

示例7: actionPerformed

import javax.swing.JPanel; //导入方法依赖的package包/类
public void actionPerformed (ActionEvent evt) {
	centerPanel = new JPanel(new FlowLayout());

	maxGenerationsLabel = new JLabel("Max Generations");		
	maxGenerationsField = new JTextField((new Integer(TSProblemModel.DEFAULT_GA_MAX_GENERATIONS)).toString(), 5);
	
	popSizeLabel = new JLabel("Population Size");		
	popSizeField = new JTextField((new Integer(TSProblemModel.DEFAULT_GA_POP_SIZE)).toString(), 5);

	mutationRateLabel = new JLabel("Mutation Rate");		
	mutationRateField = new JTextField((new Double(TSProblemModel.DEFAULT_MUTATION_RATE)).toString(), 5);
	
	orderedCrossoverBox = new JCheckBox("Ordered Crossover", TSProblemModel.DEFAULT_ORDERED_CROSSOVER);
	cyclicCrossoverBox = new JCheckBox("Cyclic Crossover", TSProblemModel.DEFAULT_CYCLIC_CROSSOVER);
	pmxCrossoverBox = new JCheckBox("PMX Crossover", TSProblemModel.DEFAULT_PMX_CROSSOVER);
	simulatedAnnealingBox = new JCheckBox("Simulated Annealing", TSProblemModel.DEFAULT_ANNEAL);
	inverOverBox = new JCheckBox("Inver Over", TSProblemModel.DEFAULT_INVER_OVER);

	centerPanel.add(maxGenerationsLabel);
	centerPanel.add(maxGenerationsField);		
	centerPanel.add(popSizeLabel);
	centerPanel.add(popSizeField);
	centerPanel.add(mutationRateLabel);
	centerPanel.add(mutationRateField);			
	centerPanel.add(orderedCrossoverBox);
	centerPanel.add(cyclicCrossoverBox);	
	centerPanel.add(pmxCrossoverBox);
	centerPanel.add(inverOverBox);
	centerPanel.add(simulatedAnnealingBox);
	
	centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	centerPanel.setForeground(Color.getColor("202,198,202"));
	
	getContentPane().add(centerPanel,BorderLayout.CENTER);					
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:36,代码来源:GASettings.java

示例8: CurveViewer

import javax.swing.JPanel; //导入方法依赖的package包/类
public CurveViewer(CurveCollection curves) {
   setLayout(new BorderLayout());

    String message = curves.toString();

    criterionName = curves.getName();

    // info string
    JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    infoPanel.setOpaque(true);
    infoPanel.setBackground(Colors.WHITE);
    JTextPane infoText = new JTextPane();
    infoText.setEditable(false);
    infoText.setBackground(infoPanel.getBackground());
    infoText.setFont(infoText.getFont().deriveFont(Font.BOLD));
    infoText.setText(message);
    infoPanel.add(infoText);
    add(infoPanel, BorderLayout.NORTH);

    // plot panel
    plotter = new CurveChartPlotter();
    plotter.setCurve(curves);

    JPanel innerPanel = new JPanel(new BorderLayout());
    innerPanel.add(plotter, BorderLayout.CENTER);
    innerPanel.setBorder(BorderFactory.createMatteBorder(5, 0, 10, 10, Colors.WHITE));
    add(innerPanel, BorderLayout.CENTER);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:CurveViewer.java

示例9: initComponents

import javax.swing.JPanel; //导入方法依赖的package包/类
private void initComponents() {
    org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "UpdatePanel.infoLabel.text")); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "UpdatePanel.infoLabel2.text")); // NOI18N
    forcedUpdateChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(forcedUpdateChxBox, org.openide.util.NbBundle.getMessage(UpdatePanel.class, "UpdatePanel.forcedUpdateChxBox.text")); // NOI18N
    JPanel optionsPanel = new JPanel(new BorderLayout());
    optionsPanel.add(forcedUpdateChxBox, BorderLayout.NORTH);
    optionsPanel.setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
    setOptionsPanel(optionsPanel, null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:UpdatePanel.java

示例10: Channel

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Create the frame to choose the channel
 */
public Channel() {
	this.setTitle("Chat IRC");
	this.setResizable(false);
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.setBounds(100, 100, 460, 261);
	this.setLocationRelativeTo(null);
	setIconImage(Toolkit.getDefaultToolkit().getImage(Channel.class.getResource("/image/swag.png")));
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JButton btnOk = new JButton("OK");
	Icon imgOk = new ImageIcon(Toolkit.getDefaultToolkit().getImage(Channel.class.getResource("/image/ok.png")));
	btnOk.setIcon(imgOk);
	btnOk.setFont(new Font("Tahoma", Font.BOLD, 14));
	btnOk.addActionListener(new ChannelListener());
	btnOk.setBounds(164, 152, 104, 30);
	contentPane.add(btnOk);
	
	JLabel lblChannel = new JLabel("Channel");
	lblChannel.setHorizontalAlignment(SwingConstants.LEFT);
	lblChannel.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblChannel.setBounds(187, 30, 72, 30);
	contentPane.add(lblChannel);
	
	textFieldChannel = new JTextField();
	textFieldChannel.setFont(new Font("Tahoma", Font.PLAIN, 14));
	textFieldChannel.setBounds(115, 85, 203, 30);
	contentPane.add(textFieldChannel);
	textFieldChannel.setColumns(10);
	
	this.addWindowListener( new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			closeFrame();
		}
	});
}
 
开发者ID:LittleSnake42,项目名称:java-irc,代码行数:42,代码来源:Channel.java

示例11: displayMBeanNotificationsNode

import javax.swing.JPanel; //导入方法依赖的package包/类
private void displayMBeanNotificationsNode(DefaultMutableTreeNode node) {
    final XNodeInfo uo = (XNodeInfo) node.getUserObject();
    if (!uo.getType().equals(Type.NOTIFICATIONS)) {
        return;
    }
    mbean = (XMBean) uo.getData();
    mbeanNotifications.loadNotifications(mbean);
    updateNotifications();
    invalidate();
    mainPanel.removeAll();
    JPanel borderPanel = new JPanel(new BorderLayout());
    borderPanel.setBorder(BorderFactory.createTitledBorder(
            Messages.NOTIFICATION_BUFFER));
    borderPanel.add(new JScrollPane(mbeanNotifications));
    mainPanel.add(borderPanel, BorderLayout.CENTER);
    // add the subscribe/unsubscribe/clear buttons to the south panel
    southPanel.removeAll();
    southPanel.add(subscribeButton, BorderLayout.WEST);
    southPanel.add(unsubscribeButton, BorderLayout.CENTER);
    southPanel.add(clearButton, BorderLayout.EAST);
    southPanel.setVisible(true);
    subscribeButton.setEnabled(true);
    unsubscribeButton.setEnabled(true);
    clearButton.setEnabled(true);
    validate();
    repaint();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:XSheet.java

示例12: performContextAction

import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
protected void performContextAction(Node[] nodes) {
    final VCSContext ctx = HgUtils.getCurrentContext(nodes);
    final File roots[] = HgUtils.getActionRoots(ctx);
    if (roots == null || roots.length == 0) return;
    final File root = Mercurial.getInstance().getRepositoryRoot(roots[0]);

    final BranchSelector switchBranch = new BranchSelector(root);
    JCheckBox forcedUpdateChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(forcedUpdateChxBox, org.openide.util.NbBundle.getMessage(SwitchToBranchAction.class, "SwitchTo.forcedUpdateChxBox.text")); // NOI18N
    JPanel optionsPanel = new JPanel(new BorderLayout());
    optionsPanel.add(forcedUpdateChxBox, BorderLayout.NORTH);
    optionsPanel.setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
    switchBranch.setOptionsPanel(optionsPanel, null);
    
    JButton okButton = new JButton();
    org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(BranchSelector.class, "CTL_SwitchToForm_Action_SwitchTo")); // NOI18N
    okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BranchSelector.class, "ACSD_SwitchToForm_Action_SwitchTo")); // NOI18N
    okButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BranchSelector.class, "ACSN_SwitchToForm_Action_SwitchTo")); // NOI18N
    okButton.setEnabled(false);
    
    if (!switchBranch.showDialog(okButton, org.openide.util.NbBundle.getMessage(BranchSelector.class, "CTL_SwitchToDialog", root.getName()), //NOI18N
            org.openide.util.NbBundle.getMessage(SwitchToBranchAction.class, "SwitchToPanel.infoLabel.text"))) { //NOI18N
        return;
    }
    final String revStr = switchBranch.getBranchName();
    if (revStr == null) {
        return;
    }
    final boolean doForcedUpdate = forcedUpdateChxBox.isSelected();
    doSwitch(root, revStr, doForcedUpdate, ctx); //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:SwitchToBranchAction.java

示例13: initComponents

import javax.swing.JPanel; //导入方法依赖的package包/类
private void initComponents() {
	//building mainPanel
	this.setLayout(new BorderLayout(5, 5));
	this.setBorder(new EmptyBorder(5, 5, 5, 5));
	//layout of main panel
	JPanel serversNumPanel = new JPanel();
	serversNumPanel.setBorder(new TitledBorder(new EtchedBorder(), "Number of Servers"));
	serversNumPanel.add(new JLabel("Number:"));
	serversNumPanel.add(serversNumSpinner);
	this.add(serversNumPanel, BorderLayout.NORTH);
	WarningScrollTable ServiceSectionTable = new WarningScrollTable(serviceTable, WARNING_CLASS);
	ServiceSectionTable.setBorder(new TitledBorder(new EtchedBorder(), "Service Time Distributions"));
	this.add(ServiceSectionTable, BorderLayout.CENTER);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:15,代码来源:ServiceSectionPanel.java

示例14: createWindow

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * Create the installation window which the pages appear in.
 */
private void createWindow()
{
	JImage sideImage = new JImage(getClass().getResource(imagePath));
	sideImage.setVerticalAlignment(SwingConstants.TOP);
	sideImage.setAlignmentY(Component.TOP_ALIGNMENT);

	pageArea = new JPanel();
	pageArea.setLayout(new GridLayout(1, 1));

	JSeparator bar = new JSeparator();

	navArea = new JPanel();
	navArea.setLayout(new GridLayout(1, 1));

	JPanel bottom = new JPanel(new BorderLayout(5, 5));
	bottom.add(bar, BorderLayout.NORTH);
	bottom.add(navArea, BorderLayout.CENTER);

	JPanel all = new JPanel(new BorderLayout(5, 5));
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	all.add(sideImage, BorderLayout.WEST);
	all.add(pageArea, BorderLayout.CENTER);
	all.add(bottom, BorderLayout.SOUTH);

	frame = new JFrame();
	frame.getContentPane().add(all);
	frame.setTitle(productName);
	frame.setResizable(false);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
开发者ID:equella,项目名称:Equella,代码行数:34,代码来源:Wizard.java

示例15: configure

import javax.swing.JPanel; //导入方法依赖的package包/类
private void configure(JInputComponent input) {
	this.input = input;
	this.value = input.getValue();

	// Thanks to Christophe Jacquet, who contributed a fix to this
	// so that when the dialog is resized, the component within it
	// is resized as well. (Tracker #2024479)
	JPanel p = new JPanel(new BorderLayout());
	p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	p.add((JComponent) input, BorderLayout.CENTER);
	getContentPane().add(p, BorderLayout.CENTER);

	pack();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:AttrTable.java


注:本文中的javax.swing.JPanel.setBorder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。