Пример #1
0
  public static void loadProgramIcons() {
    Properties prop = new Properties();
    try {

      File IconFile = new File(SystemInfo.getProgramPath() + "/StartData/ProgramIcons.txt");
      System.out.println("Program path: " + IconFile.getAbsolutePath());
      prop.load(new FileInputStream(IconFile));
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    int numberOfIcons = Integer.parseInt(prop.getProperty("numberOfIcons"));
    ProgramIcons = new ProgramIcon[numberOfIcons];

    for (int i = 0; i < numberOfIcons; i++) {
      ProgramIcons[i] = new ProgramIcon();
      ProgramIcons[i].Name = prop.getProperty("icon" + (i + 1) + "name");
      ProgramIcons[i].ProgramPath = prop.getProperty("icon" + (i + 1) + "Path");
      ProgramIcons[i].IconPath = prop.getProperty("icon" + (i + 1) + "Icon");
      ProgramIcons[i].HighLightedIconPath = prop.getProperty("icon" + (i + 1) + "HighLightedIcon");
      ProgramIcons[i].LoadIcons();
      RightPanel.add(ProgramIcons[i]);
    }
  }
Пример #2
0
  public static void setupGui() {
    frame.setSize(GuiProperties.getScreenWidth(), GuiProperties.getScreenHeight());
    frame.addMouseListener(frameListener);
    frame.addMouseMotionListener(frameListener);
    frame.setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setUndecorated(true);

    desktop.setBackground(Colors.getDarkBackground());
    desktop.setLayout(null);
    frame.add(desktop, BorderLayout.CENTER);

    TopPanel.setPreferredSize(new Dimension(GuiProperties.getScreenWidth(), 50));
    TopPanel.setBackground(Colors.getBackground());
    TopPanel.setLayout(null);
    frame.add(TopPanel, BorderLayout.NORTH);

    RightPanel.setPreferredSize(new Dimension(50, GuiProperties.getScreenHeight()));
    RightPanel.setBackground(Colors.getBackground());
    RightPanel.setLayout(new BoxLayout(RightPanel, BoxLayout.Y_AXIS));
    frame.add(RightPanel, BorderLayout.EAST);

    WidgetContainer wc = new WidgetContainer();
    wc.setSize(200, 200);
    wc.setLocation(200, 200);
    desktop.add(wc);

    TaskManagerGui gui = new TaskManagerGui(wc);
    wc.add(gui);

    clock.setSize(GuiProperties.getScreenWidth() / 20, 50);
    clock.setLocation(GuiProperties.getScreenWidth() - GuiProperties.getScreenWidth() / 20, 0);
    TopPanel.add(clock);

    loadProgramIcons();
    RightPanel.revalidate();
    desktop.revalidate();
    frame.setVisible(true);
  }