Below are some snippets of Java code which displays various features of the Java Led Display Component.
- How to create a Led Display Component
- How to create a DisplayElement and add it to the LedDisplay
- How to update a DisplayElement
- How to customize the appearance of LedDisplay
- How to create a Led Display Component
LedDisplay ledDisplay = LedDisplayFactory.createLedDisplay();
- How to create a DisplayElement and add it to the LedDisplay
LedDisplay ledDisplay = LedDisplayFactory.createLedDisplay(); DisplayElement displayElement = new MyDisplayElement(); ledDisplay.setDisplayElement(displayElement);- How to update a DisplayElement
LedDisplay ledDisplay = LedDisplayFactory.createLedDisplay(); DisplayElement displayElement = new MyDisplayElement(); ledDisplay.setDisplayElement(displayElement); // code to customize displayElement ledDisplay.update();- How to customize the appearance of LedDisplay
LedDisplay ledDisplay = LedDisplayFactory.createLedDisplay(); // Set the background color of the LedDisplay ledDisplay.setBackgroundColor(new Color(51, 51, 51)); // Set the color of a turned off dot ledDisplay.setDotOffColor(Color.BLACK); // Set the dimensions, in pixels, of the display's led // Default values are (1, 1). ledDisplay.setDotSize(2, 2); // Set the gaps, in pixels, between two display leds. // Default values are (1, 1). ledDisplay.setDotGaps(2, 2);] // Set the gap, in dots, between two tokens of an element. // Default value is 2. ledDisplay.setTokenGap(4); // Set the padding (top, left, bottom, right). // The padding represents the number of dots separating the element from // the edges of the display. ledDisplay.setPadding(1, 1, 1, 1); // Set the anchor. // The anchor represents the location of the element on the display when // the display area is larger than the element. // The anchors are : LedDisplay.CENTER // LedDisplay.NORTH // LedDisplay.WEST // LedDisplay.EAST // LedDisplay.SOUTH // LedDisplay.NORTHWEST // LedDisplay.NORTHEAST // LedDisplay.SOUTHWEST // LedDisplay.SOUTHEAST ledDisplay.setAnchor(LedDisplay.CENTER); - How to create a DisplayElement and add it to the LedDisplay