當前位置: 首頁>>代碼示例>>Java>>正文


Java JPanel.applyComponentOrientation方法代碼示例

本文整理匯總了Java中javax.swing.JPanel.applyComponentOrientation方法的典型用法代碼示例。如果您正苦於以下問題:Java JPanel.applyComponentOrientation方法的具體用法?Java JPanel.applyComponentOrientation怎麽用?Java JPanel.applyComponentOrientation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JPanel的用法示例。


在下文中一共展示了JPanel.applyComponentOrientation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Renderer

import javax.swing.JPanel; //導入方法依賴的package包/類
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);

	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:51,代碼來源:FileListPanel.java

示例2: initialize

import javax.swing.JPanel; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:BlidiWajdi,項目名稱:Mujeed-Arabic-Prolog,代碼行數:66,代碼來源:SwitechWorkSpaceWindow.java


注:本文中的javax.swing.JPanel.applyComponentOrientation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。