Java Code Examples for com.alee.laf.text.WebTextArea#setFont()
The following examples show how to use
com.alee.laf.text.WebTextArea#setFont() .
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
Source File: BuildingPanelResourceProcessing.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param processor the resource processing building this panel is for. * @param desktop The main desktop. */ public BuildingPanelResourceProcessing(ResourceProcessing processor, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(processor.getBuilding(), desktop); // Initialize variables. this.processor = processor; // Set layout setLayout(new BorderLayout()); // Prepare resource processes label // 2014-11-21 Changed font type, size and color and label text // 2014-11-21 Added internationalization for labels WebLabel resourceProcessesLabel = new WebLabel(Msg.getString("BuildingPanelResourceProcessing.title"), WebLabel.CENTER); resourceProcessesLabel.setFont(new Font("Serif", Font.BOLD, 16)); //resourceProcessesLabel.setForeground(new Color(102, 51, 0)); // dark brown add(resourceProcessesLabel, BorderLayout.NORTH); WebLabel supportedProcessesLabel = new WebLabel(Msg.getString("BuildingPanelResourceProcessing.supportedProcesses"), WebLabel.CENTER); add(supportedProcessesLabel, BorderLayout.CENTER); // Get all processes at building. List<ResourceProcess> processes = processor.getProcesses(); int size = processes.size(); // Prepare resource processes list panel. // WebPanel resourceProcessesListPanel = new WebPanel(new GridLayout(processes.size(), 2, 10, 3)); // resourceProcessesListPanel.setBorder(new EmptyBorder(3, 20, 3, 20)); //(int top, int left, int bottom, int right) //resourceProcessesListPanel.setOpaque(false); //resourceProcessesListPanel.setBackground(new Color(0,0,0,128)); WebTextArea processesTA = new WebTextArea(); processesTA.setEditable(false); processesTA.setFont(new Font("SansSerif", Font.ITALIC, 12)); processesTA.setColumns(12); // For each specialty, add specialty name panel. for (ResourceProcess p : processes) { processesTA.append(" " + p.getProcessName()+ " "); if (!p.equals(processes.get(size-1))) //if it's NOT the last one processesTA.append("\n"); // if (p.isProcessRunning()) { // processLabel.setIcon(greenDot); // processLabel.setToolTipText(p.getProcessName() + " process is running."); // } // else { // processLabel.setIcon(redDot); // processLabel.setToolTipText(p.getProcessName() + " process is not running."); // } } WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.add(processesTA); processesTA.setBorder(new MarsPanelBorder()); // resourceProcessesListPanel.setBorder(new MarsPanelBorder()); // listPanel.add(resourceProcessesListPanel); add(listPanel, BorderLayout.SOUTH); //listPanel.setOpaque(false); //listPanel.setBackground(new Color(0,0,0,128)); // Load green and red dots. // greenDot = new ImageIcon("images/GreenDot.png", "Process is running."); // redDot = new ImageIcon("images/RedDot.png", "Process is not running"); // For each resource process, add a label. // processLabels = new ArrayList<WebLabel>(processes.size()); // Iterator<ResourceProcess> i = processes.iterator(); // while (i.hasNext()) { // ResourceProcess process = i.next(); // WebLabel processLabel = new WebLabel(process.getProcessName(), WebLabel.LEFT); // //processLabel.setForeground(Color.DARK_GRAY); // //processLabel.setBackground(Color.WHITE); // processLabel.setFont(new Font("SansSerif", Font.ITALIC, 12)); // // if (process.isProcessRunning()) { // processLabel.setIcon(greenDot); // processLabel.setToolTipText(process.getProcessName() + " process is running."); // } // else { // processLabel.setIcon(redDot); // processLabel.setToolTipText(process.getProcessName() + " process is not running."); // } // //// resourceProcessesListPanel.add(processLabel); // processLabels.add(processLabel); // } }
Example 2
Source File: BuildingPanelResearch.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * @param lab the research building this panel is for. * @param desktop The main desktop. */ public BuildingPanelResearch(Research lab, MainDesktopPane desktop) { // Use BuildingFunctionPanel constructor super(lab.getBuilding(), desktop); // Initialize data members this.lab = lab; // Set panel layout setLayout(new BorderLayout()); // Prepare label panel WebPanel labelPanel = new WebPanel(new GridLayout(4, 1, 0, 0)); add(labelPanel, BorderLayout.NORTH); labelPanel.setOpaque(false); labelPanel.setBackground(new Color(0,0,0,128)); // Prepare research label WebLabel researchLabel = new WebLabel(Msg.getString("BuildingPanelResearch.title"), WebLabel.CENTER); //$NON-NLS-1$ researchLabel.setFont(new Font("Serif", Font.BOLD, 16)); //researchLabel.setForeground(new Color(102, 51, 0)); // dark brown labelPanel.add(researchLabel); // Prepare researcher number label researchersCache = lab.getResearcherNum(); researchersLabel = new WebLabel(Msg.getString("BuildingPanelResearch.numberOfResearchers", researchersCache), WebLabel.CENTER); labelPanel.add(researchersLabel); // Prepare researcher capacityLabel WebLabel researcherCapacityLabel = new WebLabel(Msg.getString("BuildingPanelResearch.researcherCapacity", lab.getLaboratorySize()), WebLabel.CENTER); labelPanel.add(researcherCapacityLabel); // Prepare specialties label WebLabel specialtiesLabel = new WebLabel(Msg.getString("BuildingPanelResearch.namesOfSpecialties"), WebLabel.CENTER); labelPanel.add(specialtiesLabel); // Get the research specialties of the building. ScienceType[] specialties = lab.getTechSpecialties(); int size = specialties.length; WebTextArea specialtyTA = new WebTextArea(); specialtyTA.setEditable(false); specialtyTA.setFont(new Font("SansSerif", Font.ITALIC, 12)); specialtyTA.setColumns(7); // For each specialty, add specialty name panel. for (ScienceType specialty : specialties) { specialtyTA.append(" " + specialty.getName()+ " "); if (!specialty.equals(specialties[size-1])) //if it's NOT the last one specialtyTA.append("\n"); } WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.add(specialtyTA); specialtyTA.setBorder(new MarsPanelBorder()); add(listPanel, BorderLayout.CENTER); listPanel.setOpaque(false); listPanel.setBackground(new Color(0,0,0,128)); }
Example 3
Source File: LaboratoryTabPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; Lab lab = rover.getLab(); // Prepare laboratory panel WebPanel laboratoryPanel = new WebPanel(new BorderLayout()); topContentPanel.add(laboratoryPanel); // Prepare name panel WebPanel titlePanel = new WebPanel(); laboratoryPanel.add(titlePanel, BorderLayout.NORTH); // Prepare laboratory label WebLabel titleLabel = new WebLabel("Laboratory", WebLabel.CENTER); titleLabel.setFont(new Font("Serif", Font.BOLD, 16)); titlePanel.add(titleLabel); // Prepare the top panel using spring layout. WebPanel springPanel = new WebPanel(new SpringLayout()); // springPanel.setPadding(10, 0, 0, 0); laboratoryPanel.add(springPanel, BorderLayout.CENTER); // Prepare label panel // WebPanel labelPanel = new WebPanel(new GridLayout(3, 1)); // laboratoryPanel.add(labelPanel, BorderLayout.CENTER); // Prepare researcher number label WebLabel headerLabel0 = new WebLabel("Number of Researchers : ", WebLabel.CENTER); springPanel.add(headerLabel0); researchersCache = lab.getResearcherNum(); researchersLabel = new WebLabel("" + researchersCache, WebLabel.CENTER); springPanel.add(researchersLabel); // Prepare researcher capacityLabel WebLabel headerLabel1 = new WebLabel("Researcher Capacity : ", WebLabel.CENTER); springPanel.add(headerLabel1); WebLabel researcherCapacityLabel = new WebLabel("" + lab.getLaboratorySize(), WebLabel.CENTER); springPanel.add(researcherCapacityLabel); // Lay out the spring panel. SpringUtilities.makeCompactGrid(springPanel, 2, 2, //rows, cols 90, 10, //initX, initY 10, 4); //xPad, yPad // Get the research specialties of the building. ScienceType[] specialties = lab.getTechSpecialties(); int size = specialties.length; // Prepare specialty text area WebTextArea specialtyTA = new WebTextArea(); specialtyTA.setEditable(false); specialtyTA.setFont(new Font("SansSerif", Font.ITALIC, 12)); specialtyTA.setColumns(10); // specialtyTA.setSize(100, 60); specialtyTA.setBorder(new MarsPanelBorder()); WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.setSize(150, 80); listPanel.add(specialtyTA); TitledBorder titledBorder = BorderFactory.createTitledBorder(null, "Specialties", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Serif", Font.BOLD, 14), java.awt.Color.darkGray); listPanel.setBorder(titledBorder); // Prepare specialties label // WebLabel specialtiesLabel = new WebLabel("Specialties : ", WebLabel.CENTER); // listPanel.add(specialtiesLabel, BorderLayout.NORTH); laboratoryPanel.add(listPanel, BorderLayout.SOUTH); // For each specialty, add specialty name panel. for (ScienceType specialty : specialties) { specialtyTA.append(" " + specialty.getName()+ " "); if (!specialty.equals(specialties[size-1])) //if it's NOT the last one specialtyTA.append("\n"); } }
Example 4
Source File: TabPanelGeneral.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void createBigFive() { PersonalityTraitManager p = person.getMind().getTraitManager(); // int o = p.getPersonalityTrait(PersonalityTraitType.OPENNESS); // int c = p.getPersonalityTrait(PersonalityTraitType.CONSCIENTIOUSNESS); // int e = p.getPersonalityTrait(PersonalityTraitType.EXTRAVERSION); //getIntrovertExtrovertScore(); // int a = p.getPersonalityTrait(PersonalityTraitType.AGREEABLENESS); // int n = p.getPersonalityTrait(PersonalityTraitType.NEUROTICISM); String[] types = new String[5]; int[] scores = new int[5]; for (PersonalityTraitType t : PersonalityTraitType.values()) { types[t.ordinal()] = t.getName(); scores[t.ordinal()] = p.getPersonalityTrait(t); } // Prepare MBTI text area WebTextArea ta = new WebTextArea(); ta.setEditable(false); ta.setFont(new Font("Monospaced", Font.PLAIN, 12)); ta.setColumns(14); // specialtyTA.setSize(100, 60); ta.setBorder(new MarsPanelBorder()); WebPanel listPanel = new WebPanel(new FlowLayout(FlowLayout.CENTER)); listPanel.setSize(110, 150); listPanel.add(ta); centerContentPanel.add(listPanel, BorderLayout.SOUTH); TitledBorder titledBorder = BorderFactory.createTitledBorder(null, "Personality scores based on Big Five", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Serif", Font.PLAIN, 12), java.awt.Color.darkGray); listPanel.setBorder(titledBorder); for (int i = 0; i < 5; i++) { // StringBuffer sb = new StringBuffer(); String s = types[i]; int size = 18 - s.length(); while (size > 0) { ta.append(" "); size--; } ta.append(" " + s + " : " + scores[i] + " "); if (i < 4) //if it's NOT the last one ta.append("\n"); } }