Skip to content

Instantly share code, notes, and snippets.

View k33ptoo's full-sized avatar
💻
Anything frontend & Kotlin

Amos Chepchieng k33ptoo

💻
Anything frontend & Kotlin
View GitHub Profile
@k33ptoo
k33ptoo / BunifuCharts.cs
Last active April 27, 2021 04:33
Bunifu Charts Overall Rendering Code
/*
* A Bunifu Charts Get Started code
* Copyright 2021 Bunifu Framework.
*/
public static void renderBarchart(Bunifu.Charts.WinForms.BunifuChartCanvas bunifuChartCanvas)
{
Bunifu.Charts.WinForms.ChartTypes.BunifuBarChart bunifuBarChart = new Bunifu.Charts.WinForms.ChartTypes.BunifuBarChart();
/*
* For this example we will use random numbers
@k33ptoo
k33ptoo / CustomTitleBar.java
Last active October 31, 2019 12:47
Check if User is using another OS switch Java Swing Titlebar
if (OSUtils.getOSType() == OSUtils.OSType.MacOS) {
pnlTop.remove(pnlTitle);
pnlTop.remove(pnlRight);
pnlTop.add(pnlTitle, BorderLayout.EAST);
pnlTop.add(pnlActions, BorderLayout.WEST);
pnlActions.remove(lblClose);
pnlActions.remove(lblMaximize);
pnlActions.remove(lblMinimize);
@k33ptoo
k33ptoo / HintJTextFields.java
Last active April 3, 2019 10:39
A custom hint creator for Java Swing JTextField
//on init components
//add your TextFields Here
JTextField[] tfs = {jTextField1,jTextField2};
setHintText(tfs);
private void setHintText(JTextField[] tfs) {
for (JTextField jtf : tfs) {
jtf.addFocusListener(new FocusListener() {
@Override
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
public class StudentsModel {
private SimpleIntegerProperty studentId;
private SimpleStringProperty firstName;
private SimpleStringProperty lastName;
@k33ptoo
k33ptoo / StudentController.java
Last active July 1, 2018 07:47
Adding data to Tableview JavaFX
import home.model.StudentsModel;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
@k33ptoo
k33ptoo / Table.fxml
Created July 1, 2018 07:39
Adding data to Tableview JavaFX
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="563.0" prefWidth="1102.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="home.controllers.StudentsController">
<TableView fx:id="tbData" layoutX="20.0" layoutY="192.0" prefHeight="349.0" prefWidth="1066.0" stylesheets="@../css/fullpackstyling.css" AnchorPane.bottomAnchor="22.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="16.0" AnchorPane.topAnchor="192.0">
<columns>
<TableColumn fx:id="studentId" prefWidth="75.0" text="StudentId" />
<TableColumn fx:id="firstName" prefWidth="75.0" text="First Name" />
<TableColumn fx:id="lastName" prefWidth="75.0" text="Last Name" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
@k33ptoo
k33ptoo / AndroidManifest.xml
Last active December 15, 2017 08:05
Firebase android show notification on new item added using a service
<application>
<service
android:name=".updates.BackroundLUpdateService"
android:enabled="true"
android:exported="true"></service>
</application>
@k33ptoo
k33ptoo / Move2.java
Created November 2, 2017 15:59
Make underdecorated window movable in eclipse using WindowBuilder
JPanel panel = new JPanel();
panel.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent arg0) {
xx = arg0.getX();
xy = arg0.getY();
}
});
panel.addMouseMotionListener(new MouseMotionAdapter() {
@k33ptoo
k33ptoo / JavaFX TC .css
Created September 11, 2017 11:22
Contains basic css for customizing a TableView and Charts.
.table-view .column-header,
.table-view .column-header-background .filler {
-fx-background-color: #6622CC;
}
.table-view .column-header .label{
-fx-text-fill: white;
-fx-font-weight: bold;
-fx-alignment: CENTER_LEFT;
}
.table-view .cell{
@k33ptoo
k33ptoo / Move.java
Created August 17, 2017 16:38
A snip for making underdecorated Swing Jframes movable
int xy,xx;
//replace sidepane with your control/container to which you want to move
private void sidepaneMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sidepaneMouseDragged
// TODO add your handling code here:
int x = evt.getXOnScreen();
int y = evt.getYOnScreen();
this.setLocation(x - xx, y - xy);
}//GEN-LAST:event_sidepaneMouseDragged
private void sidepaneMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sidepaneMousePressed